KDBindings::Property¶
A property represents a value that can be part of or the result of data binding. More...
#include <property.h>
Public Types¶
Name | |
---|---|
typedef T | valuetype |
Public Functions¶
Name | |
---|---|
Property() =default | |
Property(Property< T > && other) Properties are movable. |
|
Property(Property< T > const & other) =delete | |
template <typename UpdaterT > |
Property(std::unique_ptr< UpdaterT > && updater) |
Property(T value) | |
~Property() | |
Signal & | destroyed() const |
T const & | get() const |
T const & | operator()() const |
Property & | operator=(Property< T > && other) |
Property & | operator=(Property< T > const & other) =delete |
template <typename UpdaterT > Property & |
operator=(std::unique_ptr< UpdaterT > && updater) |
Property< T > & | operator=(T const & rhs) |
void | reset() Disconnects the binding from this Property. |
void | set(T value) |
Signal< const T &, const T & > & | valueAboutToChange() const |
Signal< const T & > & | valueChanged() const |
Friends¶
Name | |
---|---|
class | Private::PropertyNode |
Detailed Description¶
1 2 |
|
A property represents a value that can be part of or the result of data binding.
Properties are at the basis of data binding. They can contain a value of any type T. The value can either represent the result of a data binding or a value that is used in the calculation of a binding expression.
If the value of a property is changed, either manually or because it is the result of a binding expression, the Property will emit the valueAboutToChange(), and valueChanged()Signal. If it is used as part of a binding expression, the expression will be marked as dirty and (unless a custom BindingEvaluator is used) updated immediately.
To create a property from a data binding expression, use the makeBoundProperty or makeBinding functions in the KDBindings namespace.
Examples:
Public Types Documentation¶
typedef valuetype¶
1 |
|
Public Functions Documentation¶
function Property¶
1 |
|
Properties are default constructable.
The value of a default constructed property is then also default constructed.
function Property¶
1 2 3 |
|
Properties are movable.
All connections that were made to the signals of the original Property are moved over to the newly-constructed Property.
All data bindings that depend on the moved-from Property will update their references to the newly move-constructed Property.
function Property¶
1 2 3 |
|
Properties are not copyable.
function Property¶
1 2 3 4 |
|
Construct a property that will be updated by the specified PropertyUpdater.
This constructor is usually called by the creation of a data binding and usually doesn't need to be called manually.
function Property¶
1 2 3 |
|
Constructs a Property from the provided value.
function ~Property¶
1 |
|
If a Property is destroyed, it emits the destroyed()Signal.
function destroyed¶
1 |
|
Returns a Signal that will be emitted when this Property is destructed.
function get¶
1 |
|
Returns the value represented by this Property.
function operator()¶
1 |
|
Returns the value represented by this Property.
See: get().
function operator=¶
1 2 3 |
|
See: Property(Property
function operator=¶
1 2 3 |
|
function operator=¶
1 2 3 4 |
|
Assigns a Binding or other Updater to this Property.
In comparison to the move assignment operator, this does NOT change any of the existing Signal connections. They are all kept as-is. Only the source of the update is changed.
This will immediately set the value of this Property to the result of the updater and will call the valueAboutToChange or valueChanged Signals respectively if necessary.
function operator=¶
1 2 3 |
|
Assigns a new value to this Property.
See: set().
function reset¶
1 |
|
Disconnects the binding from this Property.
If this Property has a binding, it will no longer update it. Otherwise, this function does nothing.
The value of the property does not change when it is reset.
function set¶
1 2 3 |
|
Exceptions:
- ReadOnlyProperty If the Property has a PropertyUpdater associated with it (i.e. it is the result of a binding expression).
Assign a new value to this Property.
If the new value is equal_to the existing value, the value will not be changed and no Signal will be emitted.
Otherwise, the valueAboutToChange()Signal will be emitted before the value of the Property is changed. Then, the provided value will be assigned, and the valueChanged()Signal will be emitted.
function valueAboutToChange¶
1 |
|
Returns a Signal that will be emitted before the value is changed.
The first emitted value is the current value of the Property.
The second emitted value is the new value of the Property.
function valueChanged¶
1 |
|
Returns a Signal that will be emitted after the value of the property changed.
The emitted value is the current (new) value of the Property.
Friends¶
friend Private::PropertyNode¶
1 2 3 |
|
Updated on 2024-07-13 at 00:00:32 +0000