Union::Properties::DisplayPropertyGroup Class
class Union::Properties::DisplayPropertyGroupA property group containing properties related to how the element is displayed. More...
| Header: | #include <DisplayPropertyGroup.h> |
| CMake: | find_package(Union REQUIRED)target_link_libraries(mytarget PRIVATE Union::Union) |
Public Functions
| DisplayPropertyGroup() | |
| DisplayPropertyGroup(const Union::Properties::DisplayPropertyGroup &other) | |
| DisplayPropertyGroup(Union::Properties::DisplayPropertyGroup &&other) | |
| bool | hasAnyValue() const |
| bool | isEmpty() const |
| std::optional<qreal> | opacity() const |
| T | safePropertyLookup(const T &defaultValue, LookupFunctions... functions) const |
| void | setOpacity(const std::optional<qreal> &newValue) |
| void | setVisible(const std::optional<bool> &newValue) |
| QString | toString(int indentation = 0, Union::Properties::ToStringFlags flags = ToStringFlags{}) const |
| std::optional<bool> | visible() const |
| Union::Properties::DisplayPropertyGroup & | operator=(Union::Properties::DisplayPropertyGroup &&other) |
| Union::Properties::DisplayPropertyGroup & | operator=(const Union::Properties::DisplayPropertyGroup &other) |
Static Public Members
| std::unique_ptr<Union::Properties::DisplayPropertyGroup> | empty() |
| void | resolveProperties(const Union::Properties::DisplayPropertyGroup *source, Union::Properties::DisplayPropertyGroup *destination) |
Related Non-Members
| QDebug | operator<<(QDebug debug, Union::Properties::DisplayPropertyGroup *type) |
| bool | operator==(const Union::Properties::DisplayPropertyGroup &left, const Union::Properties::DisplayPropertyGroup &right) |
Detailed Description
Member Function Documentation
DisplayPropertyGroup::DisplayPropertyGroup()
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.
DisplayPropertyGroup::DisplayPropertyGroup(const Union::Properties::DisplayPropertyGroup &other)
Copy constructor.
DisplayPropertyGroup::DisplayPropertyGroup(Union::Properties::DisplayPropertyGroup &&other)
Move constructor.
[static] std::unique_ptr<Union::Properties::DisplayPropertyGroup> DisplayPropertyGroup::empty()
Create and return an empty DisplayPropertyGroup instance.
This will create an empty DisplayPropertyGroup 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 DisplayPropertyGroup::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 DisplayPropertyGroup::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.
std::optional<qreal> DisplayPropertyGroup::opacity() const
The opacity of the element.
See also setOpacity().
[static] void DisplayPropertyGroup::resolveProperties(const Union::Properties::DisplayPropertyGroup *source, Union::Properties::DisplayPropertyGroup *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 DisplayPropertyGroup::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 DisplayPropertyGroup::setOpacity(const std::optional<qreal> &newValue)
Set the value of opacity.
newValue The new value or std::nullopt to unset the value.
See also opacity().
void DisplayPropertyGroup::setVisible(const std::optional<bool> &newValue)
Set the value of visible.
newValue The new value or std::nullopt to unset the value.
See also visible().
QString DisplayPropertyGroup::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<bool> DisplayPropertyGroup::visible() const
Whether the element should be shown or hidden.
See also setVisible().
Union::Properties::DisplayPropertyGroup &DisplayPropertyGroup::operator=(Union::Properties::DisplayPropertyGroup &&other)
Move assignment operator.
Union::Properties::DisplayPropertyGroup &DisplayPropertyGroup::operator=(const Union::Properties::DisplayPropertyGroup &other)
Copy assignment operator.
Related Non-Members
QDebug operator<<(QDebug debug, Union::Properties::DisplayPropertyGroup *type)
QDebug support for DisplayPropertyGroup.
bool operator==(const Union::Properties::DisplayPropertyGroup &left, const Union::Properties::DisplayPropertyGroup &right)
Equality comparison for DisplayPropertyGroup.