]> cloud.milkyroute.net Git - dolphin.git/commitdiff
KItemListView: Use own palette rather than go hunt for the scene
authorKai Uwe Broulik <kde@privat.broulik.de>
Thu, 17 Aug 2023 10:57:26 +0000 (12:57 +0200)
committerKai Uwe Broulik <kde@privat.broulik.de>
Sun, 20 Aug 2023 20:08:58 +0000 (20:08 +0000)
Documentation for `QGraphicsWidget::palette` says:
> When a widget's palette changes, it resolves its entries against its
> parent widget, or if it doesn't have a parent widget, it resolves against the scene.

So I don't see why we would need to do that ourselves.

More importantly, though, it seems in Qt 6 the palette isn't updated in time,
so when changing color schemes, Dolphin picks the old color instead of the new one,
leading to illegible font when e.g. switching between Breeze Light and Dark.

src/kitemviews/kitemlistview.cpp

index 7a3cbbcb6a7eb7cf75ceca588611b1023695eaa7..6c60ed648ebbcae26bdc9922ad6f4b8823d00e9d 100644 (file)
@@ -1034,12 +1034,9 @@ void KItemListView::updateFont()
 
 void KItemListView::updatePalette()
 {
-    if (scene() && !scene()->views().isEmpty()) {
-        KItemListStyleOption option = styleOption();
-        option.palette = scene()->views().first()->palette();
-
-        setStyleOption(option);
-    }
+    KItemListStyleOption option = styleOption();
+    option.palette = palette();
+    setStyleOption(option);
 }
 
 void KItemListView::slotItemsInserted(const KItemRangeList &itemRanges)