Jump to content

Qt for HarmonyOS/qtohosextras doc/Color Theme Example

From Qt Wiki
Revision as of 09:05, 16 September 2026 by Shawn Luo (talk | contribs) (Add example documentation from qdoc output (QTFOROH-2307))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

< Qt for HarmonyOS / qtohosextras doc

Color Theme Example

Demonstrates selecting the application color theme and reacting to dark and light theme changes.


The window offers three radio buttons that map to QOhosAppContext::ColorThemeMode::LightTheme, ColorThemeMode::DarkTheme and ColorThemeMode::FollowSystemSetting. Each selection is applied with QOhosAppContext::setColorThemeMode(). A label shows the effective theme; it is initialized from QOhosAppContext::darkThemeActive() and updated through the QOhosAppContext::darkThemeActiveChanged() signal.

Files: