Union::Style Class

class Union::Style

A collection of StyleRule instances. More...

Header: #include <Style.h>
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
QString id() const
void insert(StyleRule::Ptr style)
bool load()
Union::StyleLoader *loader() const
QList<StyleRule::Ptr> matches(const QList<Element::Ptr> &elements)
std::filesystem::path path() const
QList<StyleRule::Ptr> rules()
void setHasErrors(bool newHasErrors)

Signals

Static Public Members

Union::Style::Ptr create(const std::filesystem::path &path, 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] id : const QString

The identifier of the style.

This is effectively the filename of path().

Access functions:

QString id() const

[read-only] path : const std::filesystem::path

The path where the package for this style is located.

Access functions:

std::filesystem::path path() 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 std::filesystem::path &path, std::unique_ptr<Union::StyleLoader> &&loader)

Create a new instance of Style from a path.

path The path to create a style from. loader An instance of StyleLoader responsible for loading the actual data of this style.

void Style::insert(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<StyleRule::Ptr> Style::matches(const QList<Element::Ptr> &elements)

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

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

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