Bug 430667 - Kirigami with org.kde.desktop style doesn't use system's theme background colors
Summary: Kirigami with org.kde.desktop style doesn't use system's theme background colors
Status: CONFIRMED
Alias: None
Product: frameworks-qqc2-desktop-style
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.77.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Marco Martin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-21 15:00 UTC by george fb
Modified: 2021-12-26 13:58 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
example app (6.84 KB, application/zip)
2020-12-21 15:00 UTC, george fb
Details
screenshot of the app with and without the style (115.50 KB, image/png)
2020-12-21 15:01 UTC, george fb
Details
neochat in gnome using adwaita dark (135.60 KB, image/png)
2021-01-27 23:15 UTC, george fb
Details

Note You need to log in before you can comment on or make changes to this bug.
Description george fb 2020-12-21 15:00:12 UTC
Created attachment 134248 [details]
example app

SUMMARY
On non Plasma desktops, QML applications using Kirigami with org.kde.desktop
style don't change their background colors, only the controls change.
If I remove the org.kde.desktop style then backgrounds colors change too.

See screenshot for how the app looks with and without the style.
The text in the text field is Kirigami.Theme.backgroundColor.

STEPS TO REPRODUCE
1. Download attached example app
2. Build and run it

OBSERVED RESULT
Backgrounds color DON'T change when changing system theme.

EXPECTED RESULT
Backgrounds color SHOULD change when changing system theme.


SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20201216
KDE Frameworks Version: 5.77.0
Qt Version: 5.15.2
Kernel Version: 5.9.14-1-default
OS Type: 64-bit
Processor: 1 × AMD Ryzen 5 2600 Six-Core Processor
Memory: 3.8 GiB of RAM
Graphics Processor: llvmpipe
Comment 1 george fb 2020-12-21 15:01:08 UTC
Created attachment 134249 [details]
screenshot of the app with and without the style
Comment 2 george fb 2020-12-21 15:02:09 UTC
The DE is Xfce.
Comment 3 Nicolas Fella 2020-12-21 19:46:49 UTC
What seems to be happening is this:

When not using org.kde.desktop style Kirigami is getting colors from the builtin PlatformTheme implementation (https://invent.kde.org/frameworks/kirigami/-/blob/master/src/libkirigami/basictheme.cpp). This somehow manages to get the correct colors from the QStyle/QPalette.

When using org.kde.desktop Kirigami is using the the PlatformTheme plugin provided by org.kde.desktop (https://invent.kde.org/frameworks/qqc2-desktop-style/-/blob/master/kirigami-plasmadesktop-integration/plasmadesktoptheme.cpp), which is loading the colors using KColorScheme which tries to load the user-configured colors from a config file. Since that file likely doesn't exist fro you it gives the hardcoded default values.

I don't think I understand the code well enough to suggest a solution though.
Comment 4 george fb 2021-01-27 23:15:46 UTC
Created attachment 135246 [details]
neochat in gnome using adwaita dark

Added a screenshot of neochat in gnome using adwaita dark.
The checkbox labels are visible only on hover.

For my application I ended up adding an option to use the Breeze GUI style
https://github.com/g-fb/haruna/blob/master/src/application.cpp#L84
Comment 5 Nicolas Fella 2021-12-26 13:58:53 UTC
The problem boils down to that the QPalette and KColorScheme are not in sync. On Plasma this is done in plasma-integration (the QPalette is derived from the KColorScheme). 

Possible solutions could be:
- Have qqc2-desktop-style read QPalette directly. Not sure whether it uses any of the KColorScheme extensions
- Have a way to construct a KColorScheme from a QPalette. Not trivial since KColorScheme offers additional roles, but maybe they can be auto-derived somehow