Programmatic color scheme change in QKdeTheme
Axel Spoerl
axel.spoerl at qt.io
Mon Mar 10 18:24:04 GMT 2025
Hi David,
I just did some debugging to find out, how KDE Palettes are promoted to the QKdeTheme.
The blunt answer is: They don't, and they have never been.
They were probably meant to be promoted at some point, because QKdeTheme implements an array of QPalette pointers (size == NPalettes == 17).
So for each palette type, a new QPalette could be constructed from a KDE Palette. But that's not happening. The first record of the array is populated with default constructed QPalette, which is a fusion palette.
All other records are initialized with nullptr and they remain like that throughout the life time of the QGuiApplication.
QKdeTheme just implements font handling. Color wise, QGuiApplications won't blend in with KDE palettes. They just stick with a default fusion palette.
That said: I think there's nothing needed right now. But we may want to pimp up QKdeTheme.
The patch I mentioned factors it out from qgenericunixthemes.cpp. So enhancing the class will become a little easier.
Cheers
Axel
________________________________
From: David Redondo <kde at david-redondo.de>
Sent: Monday, 10 March 2025 17:39
To: kde-devel at kde.org <kde-devel at kde.org>
Cc: Axel Spoerl <axel.spoerl at qt.io>
Subject: Re: Programmatic color scheme change in QKdeTheme
[You don't often get email from kde at david-redondo.de. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
Hi Alex,
Am Montag, 10. März 2025, 16:49 schrieb Axel Spoerl:
> Hi KDE folks,
>
> Qt 6.8 has implemented QPlatformTheme::requestColorScheme() as a virtual function. It is meant to allow a programmatic color scheme change within a QGuiApplication. If the system's theme is dark, the application can still be light and vice versa.
> https://codereview.qt-project.org/c/qt/qtbase/+/628010 re-implements this function in QKdeTheme. In case of a deviation (requested color scheme != system color scheme), it falls back to a fusion palette (of which a dark and a light version exist).
>
Do you think it would be helpful if we would give you the palettes that result when using Breeze and Breeze Dark colors that you could use instead of fusion?
Also thanks for the heads up, maybe it's something we need to implement in our own QPlatformTheme.
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-devel/attachments/20250310/a066cfa1/attachment-0001.htm>
More information about the kde-devel
mailing list