Union::Properties::LayoutPropertyGroup Class

class Union::Properties::LayoutPropertyGroup

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

Header: #include <LayoutPropertyGroup.h>
CMake: find_package(Union REQUIRED)
target_link_libraries(mytarget PRIVATE Union::Union)

Public Functions

LayoutPropertyGroup()
LayoutPropertyGroup(const Union::Properties::LayoutPropertyGroup &other)
LayoutPropertyGroup(Union::Properties::LayoutPropertyGroup &&other)
Union::Properties::AlignmentPropertyGroup *alignment() const
bool hasAnyValue() const
std::optional<qreal> height() const
Union::Properties::SizePropertyGroup *inset() const
bool isEmpty() const
Union::Properties::SizePropertyGroup *margins() const
Union::Properties::SizePropertyGroup *padding() const
T safePropertyLookup(const T &defaultValue, LookupFunctions... functions) const
void setAlignment(std::unique_ptr<Union::Properties::AlignmentPropertyGroup> &&newValue)
void setHeight(const std::optional<qreal> &newValue)
void setInset(std::unique_ptr<Union::Properties::SizePropertyGroup> &&newValue)
void setMargins(std::unique_ptr<Union::Properties::SizePropertyGroup> &&newValue)
void setPadding(std::unique_ptr<Union::Properties::SizePropertyGroup> &&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::LayoutPropertyGroup &operator=(Union::Properties::LayoutPropertyGroup &&other)
Union::Properties::LayoutPropertyGroup &operator=(const Union::Properties::LayoutPropertyGroup &other)

Static Public Members

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

Detailed Description

Member Function Documentation

LayoutPropertyGroup::LayoutPropertyGroup()

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.

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

Copy constructor.

LayoutPropertyGroup::LayoutPropertyGroup(Union::Properties::LayoutPropertyGroup &&other)

Move constructor.

Union::Properties::AlignmentPropertyGroup *LayoutPropertyGroup::alignment() const

A property group with properties related to alignment.

See also setAlignment().

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

Create and return an empty LayoutPropertyGroup instance.

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

The implicit (initial) height of an element.

See also setHeight().

Union::Properties::SizePropertyGroup *LayoutPropertyGroup::inset() const

Inset defines extra spacing around the background of an element.

See also setInset().

bool LayoutPropertyGroup::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::SizePropertyGroup *LayoutPropertyGroup::margins() const

Margins define extra spacing between sub-elements of an element.

See also setMargins().

Union::Properties::SizePropertyGroup *LayoutPropertyGroup::padding() const

Padding defines extra spacing around the content of an element.

See also setPadding().

[static] void LayoutPropertyGroup::resolveProperties(const Union::Properties::LayoutPropertyGroup *source, Union::Properties::LayoutPropertyGroup *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.

template <typename T, typename... LookupFunctions> requires (std::is_member_function_pointer_v<LookupFunctions> && ...) T LayoutPropertyGroup::safePropertyLookup(const T &defaultValue, LookupFunctions... functions) const

Perform safe property lookup of a property or the property of a subgroup.

This should be called with a list of property getter pointer-to-member functions in functions that indicate which properties to access. Each subgroup access will be checked to make sure the subgroup exists. If any of them does not exist, defaultValue will be returned. The final property lookup can be any member function of the final group. If that returns a pointer or std::optional<>, it is checked to see if it has a value. If it does, that value is returned. If not, defaultValue is returned. For functions returning anything else, the value returned by the function is returned.

Example usage:

// Lookup the value of the property "spacing" of the "layout" group.
auto spacing = StylePropertyGroup->safePropertyLookup(0.0, &StylePropertyGroup::layout, &LayoutPropertyGroup::spacing);

void LayoutPropertyGroup::setAlignment(std::unique_ptr<Union::Properties::AlignmentPropertyGroup> &&newValue)

Set the value of alignment.

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

See also alignment().

void LayoutPropertyGroup::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 LayoutPropertyGroup::setInset(std::unique_ptr<Union::Properties::SizePropertyGroup> &&newValue)

Set the value of inset.

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

See also inset().

void LayoutPropertyGroup::setMargins(std::unique_ptr<Union::Properties::SizePropertyGroup> &&newValue)

Set the value of margins.

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

See also margins().

void LayoutPropertyGroup::setPadding(std::unique_ptr<Union::Properties::SizePropertyGroup> &&newValue)

Set the value of padding.

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

See also padding().

void LayoutPropertyGroup::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 LayoutPropertyGroup::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> LayoutPropertyGroup::spacing() const

The spacing between various elements.

See also setSpacing().

QString LayoutPropertyGroup::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> LayoutPropertyGroup::width() const

The implicit (initial) width of an element.

See also setWidth().

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

Move assignment operator.

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

Copy assignment operator.

Related Non-Members

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

QDebug support for LayoutPropertyGroup.

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

Equality comparison for LayoutPropertyGroup.