From: Felix Ernst Date: Mon, 19 Feb 2024 11:32:32 +0000 (+0100) Subject: Resolve conflict between activateSoonAnimation and hoverSequenceAnimation X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/84447aab47781e381f49c8a81d9d5195fa0b4da6?ds=inline Resolve conflict between activateSoonAnimation and hoverSequenceAnimation 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. --- diff --git a/src/kitemviews/kstandarditemlistwidget.cpp b/src/kitemviews/kstandarditemlistwidget.cpp index b534338ce..2ac8f4f69 100644 --- a/src/kitemviews/kstandarditemlistwidget.cpp +++ b/src/kitemviews/kstandarditemlistwidget.cpp @@ -634,6 +634,11 @@ void KStandardItemListWidget::startActivateSoonAnimation(int timeUntilActivation m_activateSoonAnimation->start(QAbstractAnimation::DeleteWhenStopped); } +bool KStandardItemListWidget::isIconControlledByActivateSoonAnimation() const +{ + return m_activateSoonAnimation && data()["iconName"] == "folder-open"; +} + KItemListWidgetInformant *KStandardItemListWidget::createInformant() { return new KStandardItemListWidgetInformant(); @@ -1027,7 +1032,7 @@ void KStandardItemListWidget::updatePixmapCache() 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. @@ -1047,7 +1052,7 @@ void KStandardItemListWidget::updatePixmapCache() } } - if (m_pixmap.isNull()) { + if (m_pixmap.isNull() && !isIconControlledByActivateSoonAnimation()) { m_pixmap = values["iconPixmap"].value(); } diff --git a/src/kitemviews/kstandarditemlistwidget.h b/src/kitemviews/kstandarditemlistwidget.h index 5afadd8cd..8143ed181 100644 --- a/src/kitemviews/kstandarditemlistwidget.h +++ b/src/kitemviews/kstandarditemlistwidget.h @@ -245,6 +245,9 @@ private: */ static qreal columnPadding(const KItemListStyleOption &option); + /** @returns whether the usual icon should be shown or not. */ + bool isIconControlledByActivateSoonAnimation() const; + protected: QHash m_textInfo; // PlacesItemListWidget needs to access this