]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Resolve conflict between activateSoonAnimation and hoverSequenceAnimation
authorFelix Ernst <felixernst@zohomail.eu>
Mon, 19 Feb 2024 11:32:32 +0000 (12:32 +0100)
committerFelix Ernst <felixernst@kde.org>
Fri, 23 Feb 2024 10:19:39 +0000 (10:19 +0000)
Prior to this commit, the activateSoonAnimation would not play for
folders using previews. That was because the hoverSequences of
folder previews would always take priority over the
activateSoonAnimation.

This commit prioritises the activateSoonAnimation for the quick
moments in which it is active.

src/kitemviews/kstandarditemlistwidget.cpp
src/kitemviews/kstandarditemlistwidget.h

index b534338ce6be37ddbc9b8b838ead46edf653d70b..2ac8f4f693ab766bc4a926d2e585127be425b277 100644 (file)
@@ -634,6 +634,11 @@ void KStandardItemListWidget::startActivateSoonAnimation(int timeUntilActivation
     m_activateSoonAnimation->start(QAbstractAnimation::DeleteWhenStopped);
 }
 
     m_activateSoonAnimation->start(QAbstractAnimation::DeleteWhenStopped);
 }
 
+bool KStandardItemListWidget::isIconControlledByActivateSoonAnimation() const
+{
+    return m_activateSoonAnimation && data()["iconName"] == "folder-open";
+}
+
 KItemListWidgetInformant *KStandardItemListWidget::createInformant()
 {
     return new KStandardItemListWidgetInformant();
 KItemListWidgetInformant *KStandardItemListWidget::createInformant()
 {
     return new KStandardItemListWidgetInformant();
@@ -1027,7 +1032,7 @@ void KStandardItemListWidget::updatePixmapCache()
 
         int sequenceIndex = hoverSequenceIndex();
 
 
         int sequenceIndex = hoverSequenceIndex();
 
-        if (values.contains("hoverSequencePixmaps")) {
+        if (values.contains("hoverSequencePixmaps") && !isIconControlledByActivateSoonAnimation()) {
             // Use one of the hover sequence pixmaps instead of the default
             // icon pixmap.
 
             // Use one of the hover sequence pixmaps instead of the default
             // icon pixmap.
 
@@ -1047,7 +1052,7 @@ void KStandardItemListWidget::updatePixmapCache()
             }
         }
 
             }
         }
 
-        if (m_pixmap.isNull()) {
+        if (m_pixmap.isNull() && !isIconControlledByActivateSoonAnimation()) {
             m_pixmap = values["iconPixmap"].value<QPixmap>();
         }
 
             m_pixmap = values["iconPixmap"].value<QPixmap>();
         }
 
index 5afadd8cd28ada5a434b1bf4cbffcf7413227ac6..8143ed181ade7265e24f3926abe3b2ffe6d83db6 100644 (file)
@@ -245,6 +245,9 @@ private:
      */
     static qreal columnPadding(const KItemListStyleOption &option);
 
      */
     static qreal columnPadding(const KItemListStyleOption &option);
 
+    /** @returns whether the usual icon should be shown or not. */
+    bool isIconControlledByActivateSoonAnimation() const;
+
 protected:
     QHash<QByteArray, TextInfo *> m_textInfo; // PlacesItemListWidget needs to access this
 
 protected:
     QHash<QByteArray, TextInfo *> m_textInfo; // PlacesItemListWidget needs to access this