Bug 452884 - Selection text color is ignored
Summary: Selection text color is ignored
Status: CONFIRMED
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: Places (show other bugs)
Version: 5.93.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KIO Bugs
URL:
Keywords:
: 453061 (view as bug list)
Depends on:
Blocks:
 
Reported: 2022-04-22 23:58 UTC by username
Modified: 2023-03-26 16:29 UTC (History)
9 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Screenshot (10.42 KB, image/png)
2022-04-22 23:58 UTC, username
Details
attachment-5730-0.html (1.51 KB, text/html)
2022-07-08 23:48 UTC, tim
Details
attachment-16536-0.html (2.95 KB, text/html)
2022-07-09 02:49 UTC, tim
Details
screenshot (25 bytes, text/plain)
2022-07-14 03:26 UTC, tim
Details
attachment-20217-0.html (1.59 KB, text/html)
2022-07-16 01:39 UTC, tim
Details

Note You need to log in before you can comment on or make changes to this bug.
Description username 2022-04-22 23:58:20 UTC
Created attachment 148312 [details]
Screenshot

SUMMARY
Selection text color in places panel in Dolphin and open/save dialogs is ignored

The bug appeared after updating Dolphin from 21.12.3 to 22.04.0
However in open/save dialog the bug also was present before


STEPS TO REPRODUCE
1. In KDE System Settings > Appearance > Colors make sure that checkbox "Use different colors for inactive selection" NOT checked
2. Look at the places panel in Dolphin or open/save dialog

OBSERVED RESULT
Selected text color is the same as not selected (in screenshot on the left)

EXPECTED RESULT
Selected text color should be used from color scheme (in screenshot on the right)

SOFTWARE/OS VERSIONS
KDE Plasma Version: 5.24.4
KDE Frameworks Version: 5.93.0
KDE Gear Version: 22.04.0
Qt Version: 5.15.3
Comment 1 Nate Graham 2022-04-25 18:16:54 UTC
Are you using a non-default color scheme or an edited version of one of the default color schemes?
Comment 2 username 2022-04-26 05:00:30 UTC
(In reply to Nate Graham from comment #1)
> Are you using a non-default color scheme or an edited version of one of the
> default color schemes?

I am using non-default color scheme, but it makes no difference. The issue persist with default color scheme, just make sure that checkbox "Use different colors for inactive selection" NOT checked. For example how it looks with Breeze Light scheme: https://i.imgur.com/CBdHkGF.png
Also I noticed if you click on empty space in Dolphin Places panel then it will use correct text color. But if you click on the files area then it will use wrong text color.

After some digging I found possible source of the issue. In KIO src/filewidgets/kfileplacesview.cpp starting from line 175:

    const bool selectedAndActive = (opt.state & QStyle::State_Selected) && (opt.state & QStyle::State_Active);
    QIcon::Mode mode = selectedAndActive ? 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,
                 opt.rect.top() + (opt.rect.height() - m_iconSize) / 2);
    painter->drawPixmap(point, pm);

    if (!actionIcon.isNull()) {
        QPoint actionPos(isLTR ? opt.rect.right() - actionAreaWidth : opt.rect.left() + s_lateralMargin,
                         opt.rect.top() + (opt.rect.height() - actionIconSize()) / 2);
        QIcon::Mode actionMode = QIcon::Normal;
        if (selectedAndActive) {
            actionMode = QIcon::Selected;
        } else if (m_hoveredAction == index) {
            actionMode = QIcon::Active;
        }
        QPixmap actionPix = actionIcon.pixmap(actionIconSize(), actionIconSize(), actionMode);
        painter->drawPixmap(actionPos, actionPix);
    }

    if (changePalette) {
        if (activePalette == QPalette()) {
            KIconLoader::global()->resetPalette();
        } else {
            KIconLoader::global()->setCustomPalette(activePalette);
        }
    }

    if (selectedAndActive) {
        painter->setPen(opt.palette.highlightedText().color());
    } else {
        painter->setPen(opt.palette.text().color());
    }

I'm not very good programmer, but it looks like that Places panel needs to be active to use correct color, and when it loses focus it using wrong color.
Comment 3 Nate Graham 2022-04-26 14:03:33 UTC
Yep, I was beginning to suspect that too. Good programmer or no, you found the issue which is 90% of the battle! Please feel free to submit a merge request for it at https://invent.kde.org/frameworks/kio/-/merge_requests.
Comment 4 username 2022-04-27 09:46:20 UTC
(In reply to Nate Graham from comment #3)
> Yep, I was beginning to suspect that too. Good programmer or no, you found
> the issue which is 90% of the battle! Please feel free to submit a merge
> request for it at https://invent.kde.org/frameworks/kio/-/merge_requests.

I need help with this, I'm afraid my knowledge is not enough to fix bug. I tried to remove this code from line 175:

 && (opt.state & QStyle::State_Active)

But it introduces new issue.
There are 2 possible scenarios depending of "Use different colors for inactive selection" checkbox is on or off:
1) Checkbox is off. If "QStyle::State_Selected" then selection text color should be used from "opt.palette.highlightedText().color()" 
2) Checkbox is on. This is how it currently works. If "(opt.state & QStyle::State_Selected) && (opt.state & QStyle::State_Active)" then selection text color should be used from "opt.palette.highlightedText().color()". Else "opt.palette.text().color()" 

We need to somehow check if that checkbox on or off.
Comment 5 Nate Graham 2022-04-27 16:45:24 UTC
I'm CCing some people who might be able to help.
Comment 6 tim 2022-04-27 19:00:20 UTC
I believe this is the same bug:

https://bugs.kde.org/show_bug.cgi?id=453061
Comment 7 Kai Uwe Broulik 2022-04-27 19:09:24 UTC
I don't quite follow. If the panel isn't focussed, it doesn't get the selection text color. Dolphin's custom view was wrong here, now it's consistent with everywhere else.
Comment 8 tim 2022-04-27 19:19:15 UTC
(In reply to Kai Uwe Broulik from comment #7)
> I don't quite follow. If the panel isn't focussed, it doesn't get the
> selection text color. Dolphin's custom view was wrong here, now it's
> consistent with everywhere else.

https://imgur.com/a/qpmjs07

Not the panel itself, the Places item ("Desktop" in the screenshot) is selected and highlighted. The Selection text is mysteriously white.
Comment 9 username 2022-04-27 19:47:15 UTC
(In reply to Kai Uwe Broulik from comment #7)
> Dolphin's custom view was wrong here, now it's consistent with everywhere else.
No it isn't. Example screenshot: https://i.imgur.com/qVo1EK7.png
Also I found a few more affected by the issue: KDE System settings > Connections and Dolphin > Configure Dolphin > Context Menu: https://i.imgur.com/V8j8v4r.png
Comment 10 tim 2022-04-27 20:09:18 UTC
(In reply to linx.system.adm from comment #9)
> (In reply to Kai Uwe Broulik from comment #7)
> > Dolphin's custom view was wrong here, now it's consistent with everywhere else.
> No it isn't. Example screenshot: https://i.imgur.com/qVo1EK7.png
> Also I found a few more affected by the issue: KDE System settings >
> Connections and Dolphin > Configure Dolphin > Context Menu:
> https://i.imgur.com/V8j8v4r.png

Confirming this on my end as well.
Comment 11 Ahmad Samir 2022-07-08 21:59:33 UTC
Could you try with a new/fresh user account? so that it's using the default color scheme, widget style...etc.
Comment 12 tim 2022-07-08 23:48:52 UTC
Created attachment 150489 [details]
attachment-5730-0.html

I can, but it doesn't affect the default color scheme. It's only if a dark
selection text color is (supposed to be) used. Breeze doesn't use a dark
selection text. Will report back, though.

On Fri, Jul 8, 2022, 5:59 PM Ahmad Samir <bugzilla_noreply@kde.org> wrote:

> https://bugs.kde.org/show_bug.cgi?id=452884
>
> Ahmad Samir <a.samirh78@gmail.com> changed:
>
>            What    |Removed                     |Added
>
> ----------------------------------------------------------------------------
>                  CC|                            |a.samirh78@gmail.com
>
> --- Comment #11 from Ahmad Samir <a.samirh78@gmail.com> ---
> Could you try with a new/fresh user account? so that it's using the default
> color scheme, widget style...etc.
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.
Comment 13 tim 2022-07-09 02:49:16 UTC
Created attachment 150491 [details]
attachment-16536-0.html

Tested creating a new user and modifying the default Breeze Dark theme to
use a light Selection Background and a dark Selection Text, all other
defaults kept. Saved as new Color Scheme.

Result is the same. Selection Text color is ignored in the side panel of
Dolphin, unless you click on an empty space, at which point it's correct.
The behavior is the same in the other elements as described above, eg right
clicking System Tray > Configure Networks pulls up the menu and Selection
Text is white where it should be the dark color defined in the Color Scheme.

Specs:
Kubuntu 22.04 with backports-landing repo added
Plasma 5.25.2
Qt 5.15,3
Kernel 5.15. 0-41
x11
Dolphin 22.04.3


Happy to do any other tests or whatever you need, this is driving me crazy.

On Fri, Jul 8, 2022, 7:48 PM tim s <imagesfromobjects@gmail.com> wrote:

> I can, but it doesn't affect the default color scheme. It's only if a dark
> selection text color is (supposed to be) used. Breeze doesn't use a dark
> selection text. Will report back, though.
>
> On Fri, Jul 8, 2022, 5:59 PM Ahmad Samir <bugzilla_noreply@kde.org> wrote:
>
>> https://bugs.kde.org/show_bug.cgi?id=452884
>>
>> Ahmad Samir <a.samirh78@gmail.com> changed:
>>
>>            What    |Removed                     |Added
>>
>> ----------------------------------------------------------------------------
>>                  CC|                            |a.samirh78@gmail.com
>>
>> --- Comment #11 from Ahmad Samir <a.samirh78@gmail.com> ---
>> Could you try with a new/fresh user account? so that it's using the
>> default
>> color scheme, widget style...etc.
>>
>> --
>> You are receiving this mail because:
>> You are on the CC list for the bug.
>
>
Comment 14 Bharadwaj Raju 2022-07-12 16:59:29 UTC
*** Bug 453061 has been marked as a duplicate of this bug. ***
Comment 15 tim 2022-07-14 03:26:23 UTC
Created attachment 150604 [details]
screenshot

Also wanted to add that there's another new mystery color appearing in tabs. This is not defined anywhere in the color scheme. It's the greenish color in the attached screenshot. It would be preferable to be able to specify this color.
Comment 16 username 2022-07-14 08:27:15 UTC
(In reply to tim from comment #15)
> Created attachment 150604 [details]
> screenshot
> 
> Also wanted to add that there's another new mystery color appearing in tabs.
> This is not defined anywhere in the color scheme. It's the greenish color in
> the attached screenshot. It would be preferable to be able to specify this
> color.
I don't see any green in the tabs on your screenshot. It's dark background on inactive tabs, white text, purple line on the active tab and same background as in window area. The only green I see is symbol "plus"
Comment 17 tim 2022-07-16 01:39:44 UTC
Created attachment 150663 [details]
attachment-20217-0.html

It's more blueish green, where the arrow is pointing. You don't see that
color? It was blue like every other element until recently. The color of
the tabs from the screenshot is likewise not defined anywhere in the color
scheme.

On Thu, Jul 14, 2022, 4:27 AM kerriganx <bugzilla_noreply@kde.org> wrote:

> https://bugs.kde.org/show_bug.cgi?id=452884
>
> --- Comment #16 from kerriganx <linx.system.adm@gmail.com> ---
> (In reply to tim from comment #15)
> > Created attachment 150604 [details]
> > screenshot
> >
> > Also wanted to add that there's another new mystery color appearing in
> tabs.
> > This is not defined anywhere in the color scheme. It's the greenish
> color in
> > the attached screenshot. It would be preferable to be able to specify
> this
> > color.
> I don't see any green in the tabs on your screenshot. It's dark background
> on
> inactive tabs, white text, purple line on the active tab and same
> background as
> in window area. The only green I see is symbol "plus"
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.
Comment 18 tim 2022-09-30 03:00:36 UTC
Hello, just wondering if there's been any news with this? It is still very much an issue. Thanks for your time!
Comment 19 farline99 2023-03-26 16:29:44 UTC
Still an issue. Wayland, KDE Plasma 5.27.3, Dolphin 22.12.3. Graphite nord theme