Themes
-
@Rockerz
Do you want to toggle dark/light mode on...-
the whole system from C++?
=> not possible, unless you manage to modify your system settings e.g. with aDBus
signal or aQProcess
to do it on the command line. -
the application independently from the system in C++?
=> not possible at present. We might implement such a switch at some point, but that's not yet decided. -
a quick item, a widget? Preferably use
setPalette()
with the palette of your choice.setStyleSheet()
would also work, as @Pl45m4 rightfully wrote. However, it adds a lot of overhead, if the single purpose is just to modify colors.
-
-
@Rockerz
Do you want to toggle dark/light mode on...-
the whole system from C++?
=> not possible, unless you manage to modify your system settings e.g. with aDBus
signal or aQProcess
to do it on the command line. -
the application independently from the system in C++?
=> not possible at present. We might implement such a switch at some point, but that's not yet decided. -
a quick item, a widget? Preferably use
setPalette()
with the palette of your choice.setStyleSheet()
would also work, as @Pl45m4 rightfully wrote. However, it adds a lot of overhead, if the single purpose is just to modify colors.
@Axel-Spoerl said in Themes:
a quick item, a widget? Preferably use setPalette() with the palette of your choice.
It would be so nice if this were true. Depending on the operating system (I'm looking at you, Windows!) setting the palette is not sufficient. From my experience I have to say to use style sheets to make your software portable. You can use native calls to be notified of dark mode/light mode changes in the OS.
-
-
@Axel-Spoerl said in Themes:
a quick item, a widget? Preferably use setPalette() with the palette of your choice.
It would be so nice if this were true. Depending on the operating system (I'm looking at you, Windows!) setting the palette is not sufficient. From my experience I have to say to use style sheets to make your software portable. You can use native calls to be notified of dark mode/light mode changes in the OS.
@SimonSchroeder said in Themes:
setting the palette is not sufficient
Tell us more about it, preferably in a bug report!
-
From my understanding this is because on Windows the native functions are used for drawing. They don't always respect all palette choices in every single last place. This is what the documentation has to say about this (https://doc.qt.io/qt-6/qapplication.html#setPalette):
Note: Some styles do not use the palette for all drawing, for instance, if they make use of native theme engines. This is the case for the Windows Vista and macOS styles.