Union::StyleRegistry Class

class Union::StyleRegistry

A class to load and keep track of Style instances. More...

Header: #include <StyleRegistry>
CMake: find_package(Union REQUIRED)
target_link_libraries(mytarget PRIVATE Union::Union)

Public Functions

void addStyle(const std::shared_ptr<Union::Style> &style)
std::shared_ptr<Union::Style> defaultStyle()
void load()
std::shared_ptr<Union::PlatformPlugin> platform() const
void save()
std::shared_ptr<Union::Style> style(const QString &styleName, const QString &pluginName = QString{})

Static Public Members

std::shared_ptr<Union::StyleRegistry> instance()

Detailed Description

This can be considered to be the main entry point to Union. It loads input plugins and uses those to create new Style instances. It also handles caching of the Style instances.

Member Function Documentation

void StyleRegistry::addStyle(const std::shared_ptr<Union::Style> &style)

Programatically add a style to the registry.

style The style to add.

std::shared_ptr<Union::Style> StyleRegistry::defaultStyle()

Get the default Style instance as determined by the current platform.

Returns a Style instance for the current default theme.

[static] std::shared_ptr<Union::StyleRegistry> StyleRegistry::instance()

Returns the global instance of StyleRegistry.

void StyleRegistry::load()

Load any cached data from disk.

std::shared_ptr<Union::PlatformPlugin> StyleRegistry::platform() const

Returns the platform integration plugin for the current platform.

void StyleRegistry::save()

Save data to disk for caching.

std::shared_ptr<Union::Style> StyleRegistry::style(const QString &styleName, const QString &pluginName = QString{})

Get a style instance by name.

styleName The name of the style to retrieve. pluginName The name of the input plugin that provides the style. If empty, the style will be searched for in available plugins.

Returns a Style instance that matches `styleName` and `pluginName`, or `nullptr` if it could not be found.