[dolphin] [Bug 492553] Text highlight on Places panel displays correctly only after second click

[email protected] Wed, 05 Aug 2026 22:28:58 +0000
Newsgroups gmane.comp.kde.devel.bugs
Message-ID <[email protected]/>
https://bugs.kde.org/show_bug.cgi?id=492553

[email protected] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #2 from [email protected] ---
I believe this is actually an issue with how KIO handles highlighting, and
requires selected + active instead of just selected. I am unsure if this is the
correct way to fix this issue, but it does work and does not seem to break
other things for me.


diff --git a/src/filewidgets/kfileplacesview.cpp
b/src/filewidgets/kfileplacesview.cpp
index 46153992d..33192e8f7 100644
--- a/src/filewidgets/kfileplacesview.cpp
+++ b/src/filewidgets/kfileplacesview.cpp
@@ -185,8 +185,8 @@ void KFilePlacesViewDelegate::paint(QPainter *painter,
const QStyleOptionViewIte
         KIconLoader::global()->setCustomPalette(opt.palette);
     }

-    const bool selectedAndActive = (opt.state & QStyle::State_Selected) &&
(opt.state & QStyle::State_Active);
-    QIcon::Mode mode = selectedAndActive ? QIcon::Selected : QIcon::Normal;
+    const bool selected = (opt.state & QStyle::State_Selected);
+    QIcon::Mode mode = selected ? QIcon::Selected : QIcon::Normal;
     QIcon icon = index.model()->data(index,
Qt::DecorationRole).value<QIcon>();
     QPixmap pm = icon.pixmap(m_iconSize, m_iconSize, mode);
     QPoint point(isLTR ? opt.rect.left() + s_lateralMargin : opt.rect.right()
- s_lateralMargin - m_iconSize,
@@ -196,7 +196,7 @@ void KFilePlacesViewDelegate::paint(QPainter *painter,
const QStyleOptionViewIte
     if (!actionIcon.isNull()) {
         const int iconSize = actionIconSize();
         QIcon::Mode mode = QIcon::Normal;
-        if (selectedAndActive) {
+        if (selected) {
             mode = QIcon::Selected;
         } else if (m_hoveredAction == index) {
             mode = QIcon::Active;
@@ -230,7 +230,7 @@ void KFilePlacesViewDelegate::paint(QPainter *painter,
const QStyleOptionViewIte
         }
     }

-    if (selectedAndActive) {
+    if (selected) {
         painter->setPen(opt.palette.highlightedText().color());
     } else {
         painter->setPen(opt.palette.text().color());
@@ -266,7 +266,7 @@ void KFilePlacesViewDelegate::paint(QPainter *painter,
const QStyleOptionViewIte
             QColor capacityBgColor(opt.palette.color(QPalette::WindowText));
             capacityBgColor.setAlphaF(0.2 * capacityBgColor.alphaF());

-            QColor capacityFgColor(selectedAndActive ? opt.palette.color(cg,
QPalette::HighlightedText) : opt.palette.color(cg, QPalette::Highlight));
+            QColor capacityFgColor(selected ? opt.palette.color(cg,
QPalette::HighlightedText) : opt.palette.color(cg, QPalette::Highlight));
             if (usedSpace > 0.95) {
                 if (!m_warningCapacityBarColor.isValid()) {
                     m_warningCapacityBarColor = KColorScheme(cg,
KColorScheme::View).foreground(KColorScheme::NegativeText).color();

-- 
You are receiving this mail because:
You are watching all bug changes.