]> cloud.milkyroute.net Git - dolphin.git/commitdiff
[KStandardItemListWidget] Pass icon state to overlay painter
authorKai Uwe Broulik <kde@privat.broulik.de>
Wed, 24 Oct 2018 07:52:36 +0000 (09:52 +0200)
committerKai Uwe Broulik <kde@privat.broulik.de>
Wed, 24 Oct 2018 07:52:36 +0000 (09:52 +0200)
Ensures the overlay is painted in the same icon state, especially the selected one so dark overlays turn white.

Differential Revision: https://phabricator.kde.org/D16307

src/kitemviews/kstandarditemlistwidget.cpp

index 8d943ae16dd2cdb788a5cc8eb9c4d02b18344fbe..f56f68ac54007b826d458ab53e603a5c688c4e91 100644 (file)
@@ -1500,9 +1500,25 @@ QPixmap KStandardItemListWidget::pixmapForIcon(const QString& name, const QStrin
         // setup time.
         foreach (const QString& overlay, overlays) {
             if (!overlay.isEmpty()) {
+                int state = KIconLoader::DefaultState;
+
+                switch (mode) {
+                case QIcon::Normal:
+                    break;
+                case QIcon::Active:
+                    state = KIconLoader::ActiveState;
+                    break;
+                case QIcon::Disabled:
+                    state = KIconLoader::DisabledState;
+                    break;
+                case QIcon::Selected:
+                    state = KIconLoader::SelectedState;
+                    break;
+                }
+
                 // There is at least one overlay, draw all overlays above m_pixmap
                 // and cancel the check
-                KIconLoader::global()->drawOverlays(overlays, pixmap, KIconLoader::Desktop);
+                KIconLoader::global()->drawOverlays(overlays, pixmap, KIconLoader::Desktop, state);
                 break;
             }
         }