Union::Properties::StyleProperty Class

class Union::Properties::StyleProperty

The root property group for all elements. More...

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

Public Functions

StyleProperty()
StyleProperty(const Union::Properties::StyleProperty &other)
StyleProperty(Union::Properties::StyleProperty &&other)
std::optional<Union::Properties::BackgroundProperty> background() const
bool hasAnyValue() const
std::optional<Union::Properties::IconProperty> icon() const
std::optional<Union::Properties::LayoutProperty> layout() const
std::optional<Union::Properties::PaletteProperty> palette() const
void setBackground(const std::optional<Union::Properties::BackgroundProperty> &newValue)
void setIcon(const std::optional<Union::Properties::IconProperty> &newValue)
void setLayout(const std::optional<Union::Properties::LayoutProperty> &newValue)
void setPalette(const std::optional<Union::Properties::PaletteProperty> &newValue)
void setText(const std::optional<Union::Properties::TextProperty> &newValue)
std::optional<Union::Properties::TextProperty> text() const
Union::Properties::StyleProperty &operator=(Union::Properties::StyleProperty &&other)
Union::Properties::StyleProperty &operator=(const Union::Properties::StyleProperty &other)

Static Public Members

Union::Properties::StyleProperty empty()
void resolveProperties(const Union::Properties::StyleProperty &source, Union::Properties::StyleProperty &destination)
QDebug operator<<(QDebug debug, const Union::Properties::StyleProperty &type)
bool operator==(const Union::Properties::StyleProperty &left, const Union::Properties::StyleProperty &right)

Detailed Description

This class contains all the properties that are used to style an element.

Member Function Documentation

StyleProperty::StyleProperty()

Default constructor. Constructs a null instance.

A null instance in this case means an instance that does not have any values for its properties. This includes property groups.

StyleProperty::StyleProperty(const Union::Properties::StyleProperty &other)

Copy constructor.

StyleProperty::StyleProperty(Union::Properties::StyleProperty &&other)

Move constructor.

std::optional<Union::Properties::BackgroundProperty> StyleProperty::background() const

Returns the value of background.

See also setBackground().

[static] Union::Properties::StyleProperty StyleProperty::empty()

Create and return an empty StyleProperty instance.

This will create an empty StyleProperty instance, which is defined as an instance with all of its values default-constructed. Note that this is different from a default-constructed instance which will have all its values unset.

bool StyleProperty::hasAnyValue() const

Returns if this property group has any value set.

Note that for any property that is also a property group, this will also check if that group has any value.

std::optional<Union::Properties::IconProperty> StyleProperty::icon() const

Returns the value of icon.

See also setIcon().

std::optional<Union::Properties::LayoutProperty> StyleProperty::layout() const

Returns the value of layout.

See also setLayout().

std::optional<Union::Properties::PaletteProperty> StyleProperty::palette() const

Returns the value of palette.

See also setPalette().

[static] void StyleProperty::resolveProperties(const Union::Properties::StyleProperty &source, Union::Properties::StyleProperty &destination)

Copy property values from source to destination if destination does not have a property value.

This will recursively copy property values of grouped properties.

source The source property group to copy from. destination The destination property group to copy to.

void StyleProperty::setBackground(const std::optional<Union::Properties::BackgroundProperty> &newValue)

Set the value of background.

newValue The new value or std::nullopt to unset the value.

See also background().

void StyleProperty::setIcon(const std::optional<Union::Properties::IconProperty> &newValue)

Set the value of icon.

newValue The new value or std::nullopt to unset the value.

See also icon().

void StyleProperty::setLayout(const std::optional<Union::Properties::LayoutProperty> &newValue)

Set the value of layout.

newValue The new value or std::nullopt to unset the value.

See also layout().

void StyleProperty::setPalette(const std::optional<Union::Properties::PaletteProperty> &newValue)

Set the value of palette.

newValue The new value or std::nullopt to unset the value.

See also palette().

void StyleProperty::setText(const std::optional<Union::Properties::TextProperty> &newValue)

Set the value of text.

newValue The new value or std::nullopt to unset the value.

See also text().

std::optional<Union::Properties::TextProperty> StyleProperty::text() const

Returns the value of text.

See also setText().

Union::Properties::StyleProperty &StyleProperty::operator=(Union::Properties::StyleProperty &&other)

Move assignment operator.

Union::Properties::StyleProperty &StyleProperty::operator=(const Union::Properties::StyleProperty &other)

Copy assignment operator.

Related Non-Members

QDebug operator<<(QDebug debug, const Union::Properties::StyleProperty &type)

QDebug support for StyleProperty.

bool operator==(const Union::Properties::StyleProperty &left, const Union::Properties::StyleProperty &right)

Equality comparison for StyleProperty.