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)
Union::Properties::BackgroundProperty *background() const
Union::Properties::BorderProperty *border() const
Union::Properties::CornersProperty *corners() const
bool hasAnyValue() const
Union::Properties::IconProperty *icon() const
bool isEmpty() const
Union::Properties::LayoutProperty *layout() const
Union::Properties::OutlineProperty *outline() const
void setBackground(std::unique_ptr<Union::Properties::BackgroundProperty> &&newValue)
void setBorder(std::unique_ptr<Union::Properties::BorderProperty> &&newValue)
void setCorners(std::unique_ptr<Union::Properties::CornersProperty> &&newValue)
void setIcon(std::unique_ptr<Union::Properties::IconProperty> &&newValue)
void setLayout(std::unique_ptr<Union::Properties::LayoutProperty> &&newValue)
void setOutline(std::unique_ptr<Union::Properties::OutlineProperty> &&newValue)
void setShadow(std::unique_ptr<Union::Properties::ShadowProperty> &&newValue)
void setText(std::unique_ptr<Union::Properties::TextProperty> &&newValue)
Union::Properties::ShadowProperty *shadow() const
Union::Properties::TextProperty *text() const
QString toString(int indentation = 0, Union::Properties::ToStringFlags flags = ToStringFlags{}) const
Union::Properties::StyleProperty &operator=(Union::Properties::StyleProperty &&other)
Union::Properties::StyleProperty &operator=(const Union::Properties::StyleProperty &other)

Static Public Members

std::unique_ptr<Union::Properties::StyleProperty> empty()
void resolveProperties(const Union::Properties::StyleProperty *source, Union::Properties::StyleProperty *destination)
QDebug operator<<(QDebug debug, 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.

Union::Properties::BackgroundProperty *StyleProperty::background() const

Returns background if set or nullptr if not.

See also setBackground().

Union::Properties::BorderProperty *StyleProperty::border() const

Returns border if set or nullptr if not.

See also setBorder().

Union::Properties::CornersProperty *StyleProperty::corners() const

Returns corners if set or nullptr if not.

See also setCorners().

[static] std::unique_ptr<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.

Union::Properties::IconProperty *StyleProperty::icon() const

Returns icon if set or nullptr if not.

See also setIcon().

bool StyleProperty::isEmpty() const

Returns if this property is considered empty.

A property is considered empty if it has no values or if the values it contains are all considered empty values.

Union::Properties::LayoutProperty *StyleProperty::layout() const

Returns layout if set or nullptr if not.

See also setLayout().

Union::Properties::OutlineProperty *StyleProperty::outline() const

Returns outline if set or nullptr if not.

See also setOutline().

[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(std::unique_ptr<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::setBorder(std::unique_ptr<Union::Properties::BorderProperty> &&newValue)

Set the value of border.

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

See also border().

void StyleProperty::setCorners(std::unique_ptr<Union::Properties::CornersProperty> &&newValue)

Set the value of corners.

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

See also corners().

void StyleProperty::setIcon(std::unique_ptr<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(std::unique_ptr<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::setOutline(std::unique_ptr<Union::Properties::OutlineProperty> &&newValue)

Set the value of outline.

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

See also outline().

void StyleProperty::setShadow(std::unique_ptr<Union::Properties::ShadowProperty> &&newValue)

Set the value of shadow.

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

See also shadow().

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

Set the value of text.

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

See also text().

Union::Properties::ShadowProperty *StyleProperty::shadow() const

Returns shadow if set or nullptr if not.

See also setShadow().

Union::Properties::TextProperty *StyleProperty::text() const

Returns text if set or nullptr if not.

See also setText().

QString StyleProperty::toString(int indentation = 0, Union::Properties::ToStringFlags flags = ToStringFlags{}) const

Returns a string representation of this property group.

This is intended for debugging.

indentation The amount of indentation to apply. Defaults to 0. flags A set of flags that control conversion behavior.

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, Union::Properties::StyleProperty *type)

QDebug support for StyleProperty.

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

Equality comparison for StyleProperty.