Details
-
Suggestion
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.15, 6.x
Description
It'd be nice to have a property to read and write the following "requested mode"
a) Fixed Light (regardless of system setting)
b) Fixed Dark (regardless of system setting)
c) Follow the system setting.
e.g.
ApplicationWindow.theme = ApplicationWindow.Dark // Light // System RadioButton { text: "Light" checked: ApplicationWindow.theme === ApplicationWindow.Light onClicked: ApplicationWindow.theme = ApplicationWindow.Light } RadioButton { text: "Dark" checked: ApplicationWindow.theme === ApplicationWindow.Dark onClicked: ApplicationWindow.theme = ApplicationWindow.Dark } RadioButton { text: "System" checked: ApplicationWindow.theme === ApplicationWindow.System onClicked: ApplicationWindow.theme = ApplicationWindow.System }
It'd also like to have a READ only property that tells the "effective mode"
In case a) it would give Light. In case b) it would give dark. In case c) it would give Light or Dark, depending on the system.
e.g.
Label { text: ApplicationWindow.effectTheme === ApplicationWindow.Light ? "Light" : "Dark" // effectiveTheme has only two possible values }
For color bindings and theme mappings, we would naturally use the second property because it is binary in nature and we don't really need to know HOW
the value was derived, just what it is. This property would appear most likely in numerous places as styles are designed.
The three-way property would be seldom used, but is vital in being able to create a popup with three radio buttons with the three options in it to show
and set the desired mode.
The usage example can be seen in e.g. Gmail app Settings > General Settings > Theme
It'd be nice to have these two properties somewhere e.g. in
QQuickWindow or ApplicationWindow or in its attached property for QML use (or pushed further back in QWindow so it can be used with widgets too). Or, if it
suits, a completely new public helper class with c++ and QML bindings.
Attachments
Issue Links
- relates to
-
QTBUG-74210 It would be nice if there is an api to detect what mode is active (Dark/light)
- Closed
-
QTBUG-63267 Make QQuickAttachedObject public API
- Closed