Union::Properties::LayoutProperty Class

class Union::Properties::LayoutProperty

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

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

Public Functions

LayoutProperty()
LayoutProperty(const Union::Properties::LayoutProperty &other)
LayoutProperty(Union::Properties::LayoutProperty &&other)
Union::Properties::AlignmentProperty *alignment() const
bool hasAnyValue() const
std::optional<qreal> height() const
Union::Properties::SizeProperty *inset() const
bool isEmpty() const
Union::Properties::SizeProperty *margins() const
Union::Properties::SizeProperty *padding() const
void setAlignment(std::unique_ptr<Union::Properties::AlignmentProperty> &&newValue)
void setHeight(const std::optional<qreal> &newValue)
void setInset(std::unique_ptr<Union::Properties::SizeProperty> &&newValue)
void setMargins(std::unique_ptr<Union::Properties::SizeProperty> &&newValue)
void setPadding(std::unique_ptr<Union::Properties::SizeProperty> &&newValue)
void setSpacing(const std::optional<qreal> &newValue)
void setWidth(const std::optional<qreal> &newValue)
std::optional<qreal> spacing() const
QString toString(int indentation = 0, Union::Properties::ToStringFlags flags = ToStringFlags{}) const
std::optional<qreal> width() const
Union::Properties::LayoutProperty &operator=(Union::Properties::LayoutProperty &&other)
Union::Properties::LayoutProperty &operator=(const Union::Properties::LayoutProperty &other)

Static Public Members

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

Detailed Description

Member Function Documentation

LayoutProperty::LayoutProperty()

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.

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

Copy constructor.

LayoutProperty::LayoutProperty(Union::Properties::LayoutProperty &&other)

Move constructor.

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

Returns alignment if set or nullptr if not.

See also setAlignment().

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

Create and return an empty LayoutProperty instance.

This will create an empty LayoutProperty 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 LayoutProperty::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<qreal> LayoutProperty::height() const

Returns the value of height.

See also setHeight().

Union::Properties::SizeProperty *LayoutProperty::inset() const

Returns inset if set or nullptr if not.

See also setInset().

bool LayoutProperty::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::SizeProperty *LayoutProperty::margins() const

Returns margins if set or nullptr if not.

See also setMargins().

Union::Properties::SizeProperty *LayoutProperty::padding() const

Returns padding if set or nullptr if not.

See also setPadding().

[static] void LayoutProperty::resolveProperties(const Union::Properties::LayoutProperty *source, Union::Properties::LayoutProperty *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 LayoutProperty::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 LayoutProperty::setHeight(const std::optional<qreal> &newValue)

Set the value of height.

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

See also height().

void LayoutProperty::setInset(std::unique_ptr<Union::Properties::SizeProperty> &&newValue)

Set the value of inset.

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

See also inset().

void LayoutProperty::setMargins(std::unique_ptr<Union::Properties::SizeProperty> &&newValue)

Set the value of margins.

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

See also margins().

void LayoutProperty::setPadding(std::unique_ptr<Union::Properties::SizeProperty> &&newValue)

Set the value of padding.

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

See also padding().

void LayoutProperty::setSpacing(const std::optional<qreal> &newValue)

Set the value of spacing.

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

See also spacing().

void LayoutProperty::setWidth(const std::optional<qreal> &newValue)

Set the value of width.

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

See also width().

std::optional<qreal> LayoutProperty::spacing() const

Returns the value of spacing.

See also setSpacing().

QString LayoutProperty::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.

std::optional<qreal> LayoutProperty::width() const

Returns the value of width.

See also setWidth().

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

Move assignment operator.

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

Copy assignment operator.

Related Non-Members

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

QDebug support for LayoutProperty.

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

Equality comparison for LayoutProperty.