|
morph 0.1.0
Asynchronous bridge between GUI thread and business models
|
applyTheme: the ui-theme/1 token values set on an engine's MorphUi Theme singleton, which every built-in component and every host component in that engine reads. More...
Go to the source code of this file.
Functions | |
| std::vector< std::string > | morph::qt_quick::applyTheme (QQmlEngine &engine, ui::ThemeValues const &values, std::map< std::string, ui::ThemeValues, std::less<> > const &surfaces={}) |
Sets a theme's values on engine's Theme singleton. | |
| std::vector< std::string > | morph::qt_quick::applyBundleTheme (QQmlEngine &engine, std::map< std::string, std::string, std::less<> > const &themes, std::map< std::string, std::string, std::less<> > const &icons={}) |
Applies a bundle's theme to engine's Theme: the theme index's base, each of its surfaces resolved with that surface's layer, and its icon set. A bundle with no theme index applies the defaults and no icon set, so a client that opens a second application does not keep the first one's look. | |
applyTheme: the ui-theme/1 token values set on an engine's MorphUi Theme singleton, which every built-in component and every host component in that engine reads.
Specified in docs/spec/qt_quick/backend.md, "Layout and theme".
Definition in file theme.hpp.
| std::vector< std::string > morph::qt_quick::applyTheme | ( | QQmlEngine & | engine, |
| ui::ThemeValues const & | values, | ||
| std::map< std::string, ui::ThemeValues, std::less<> > const & | surfaces = {} ) |
Sets a theme's values on engine's Theme singleton.
Every MorphUi component binds its colours to Theme, and a host component that imports MorphUi reads the same instance, so both update. A path of the set the theme lacks has its default in values (ui::themeValues), which is the Theme property's own default, so applying ui::themeValues() restores the defaults. Call it on the engine's thread, before or after screens mount. A surface named in surfaces gets every colour role from its values: the theme resolved with that surface's layer (ui::resolveTheme), so a role the surface does not set is the theme's. A built-in surface (page, card, sidebar, toolbar) the map does not name keeps its built-in colours.
| engine | The engine the backend compiles its components in. |
| values | The values, from ui::themeValues. |
| surfaces | The theme's surfaces by name, each resolved with its layer; empty keeps the built-in ones. |
| std::vector< std::string > morph::qt_quick::applyBundleTheme | ( | QQmlEngine & | engine, |
| std::map< std::string, std::string, std::less<> > const & | themes, | ||
| std::map< std::string, std::string, std::less<> > const & | icons = {} ) |
Applies a bundle's theme to engine's Theme: the theme index's base, each of its surfaces resolved with that surface's layer, and its icon set. A bundle with no theme index applies the defaults and no icon set, so a client that opens a second application does not keep the first one's look.
| engine | The engine the backend compiles its components in. |
| themes | The bundle's theme files by id (ui::Bundle::themes). |
| icons | The bundle's icon set, by icon name, as SVG text (ui::Bundle::icons); empty declares none. |