Union::Style Class

class Union::Style

A collection of StyleRule instances. More...

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

Public Types

Ptr

Properties

Public Functions

void addCachePath(const std::filesystem::path &path)
bool hasErrors() const
void insert(Union::StyleRule::Ptr style)
bool load()
Union::StyleLoader *loader() const
QList<Union::StyleRule::Ptr> matches(const QList<Union::Element::Ptr> &elements)
QString name() const
QString pluginName() const
QList<Union::StyleRule::Ptr> rules()
void setHasErrors(bool newHasErrors)

Signals

Static Public Members

Union::Style::Ptr create(const QString &pluginName, const QString &styleName, std::unique_ptr<Union::StyleLoader> &&loader)

Detailed Description

Member Type Documentation

[alias] Style::Ptr

Shorthand for std::shared_ptr<Style>

Property Documentation

hasErrors : bool

Whether the style encountered any errors while loading.

Access functions:

bool hasErrors() const
void setHasErrors(bool newHasErrors)

Notifier signal:

void hasErrorsChanged()

[read-only] name : const QString

The name of the style.

Access functions:

QString name() const

[read-only] pluginName : const QString

The name of the plugin used to load rules for this Style.

Access functions:

QString pluginName() const

Member Function Documentation

void Style::addCachePath(const std::filesystem::path &path)

Add a path to the list of files that should be considered for caching.

[static] Union::Style::Ptr Style::create(const QString &pluginName, const QString &styleName, std::unique_ptr<Union::StyleLoader> &&loader)

Create a new instance of Style.

pluginName The name of the plugin responsible for creating this style. styleName The name of this style. loader An instance of StyleLoader responsible for loading the actual data of this style.

void Style::insert(Union::StyleRule::Ptr style)

Insert a new rule into the style.

style The new rule to add.

bool Style::load()

Load the style.

Returns true on success or false if an error occurred.

Union::StyleLoader *Style::loader() const

Returns the StyleLoader of this style.

QList<Union::StyleRule::Ptr> Style::matches(const QList<Union::Element::Ptr> &elements)

Returns the list of StyleRule instances that matches a given list of Element instances.

QList<Union::StyleRule::Ptr> Style::rules()

Returns the list of all StyleRule instances contained in this style.