Union::Properties::TextProperty Class

class Union::Properties::TextProperty

A property group containing properties related to the text of an element. More...

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

Public Functions

TextProperty()
TextProperty(const Union::Properties::TextProperty &other)
TextProperty(Union::Properties::TextProperty &&other)
Union::Properties::AlignmentProperty *alignment() const
std::optional<Union::Color> color() const
std::optional<QFont> font() const
bool hasAnyValue() const
bool isEmpty() const
void setAlignment(std::unique_ptr<Union::Properties::AlignmentProperty> &&newValue)
void setColor(const std::optional<Union::Color> &newValue)
void setFont(const std::optional<QFont> &newValue)
QString toString(int indentation = 0, Union::Properties::ToStringFlags flags = ToStringFlags{}) const
Union::Properties::TextProperty &operator=(Union::Properties::TextProperty &&other)
Union::Properties::TextProperty &operator=(const Union::Properties::TextProperty &other)

Static Public Members

std::unique_ptr<Union::Properties::TextProperty> empty()
void resolveProperties(const Union::Properties::TextProperty *source, Union::Properties::TextProperty *destination)
QDebug operator<<(QDebug debug, Union::Properties::TextProperty *type)
bool operator==(const Union::Properties::TextProperty &left, const Union::Properties::TextProperty &right)

Detailed Description

Member Function Documentation

TextProperty::TextProperty()

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.

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

Copy constructor.

TextProperty::TextProperty(Union::Properties::TextProperty &&other)

Move constructor.

Union::Properties::AlignmentProperty *TextProperty::alignment() const

Returns alignment if set or nullptr if not.

See also setAlignment().

std::optional<Union::Color> TextProperty::color() const

Returns the value of color.

See also setColor().

[static] std::unique_ptr<Union::Properties::TextProperty> TextProperty::empty()

Create and return an empty TextProperty instance.

This will create an empty TextProperty 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.

std::optional<QFont> TextProperty::font() const

Returns the value of font.

See also setFont().

bool TextProperty::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.

bool TextProperty::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.

[static] void TextProperty::resolveProperties(const Union::Properties::TextProperty *source, Union::Properties::TextProperty *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 TextProperty::setAlignment(std::unique_ptr<Union::Properties::AlignmentProperty> &&newValue)

Set the value of alignment.

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

See also alignment().

void TextProperty::setColor(const std::optional<Union::Color> &newValue)

Set the value of color.

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

See also color().

void TextProperty::setFont(const std::optional<QFont> &newValue)

Set the value of font.

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

See also font().

QString TextProperty::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::TextProperty &TextProperty::operator=(Union::Properties::TextProperty &&other)

Move assignment operator.

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

Copy assignment operator.

Related Non-Members

QDebug operator<<(QDebug debug, Union::Properties::TextProperty *type)

QDebug support for TextProperty.

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

Equality comparison for TextProperty.