KDBindings API Documentation
1.0.95
|
A property represents a value that can be part of or the result of data binding. More...
#include <property.h>
Public Types | |
typedef T | valuetype |
Public Member Functions | |
Property ()=default | |
Property (Property< T > &&other) noexcept(std::is_nothrow_move_constructible< T >::value) | |
Properties are movable. More... | |
Property (Property< T > const &other)=delete | |
template<typename UpdaterT > | |
Property (std::unique_ptr< UpdaterT > &&updater) | |
Property (T value) noexcept(std::is_nothrow_move_constructible< T >::value) | |
~Property () | |
Signal & | destroyed () const |
T const & | get () const |
bool | hasBinding () const noexcept |
T const & | operator() () const |
Property & | operator= (Property< T > &&other) noexcept(std::is_nothrow_move_assignable< T >::value) |
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. More... | |
void | set (T value) |
Signal< const T &, const T & > & | valueAboutToChange () const |
Signal< const T & > & | valueChanged () const |
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:
Definition at line 137 of file property.h.
typedef T KDBindings::Property< T >::valuetype |
Definition at line 140 of file property.h.
|
default |
Properties are default constructable.
The value of a default constructed property is then also default constructed.
|
inline |
If a Property is destroyed, it emits the destroyed() Signal.
Definition at line 152 of file property.h.
References KDBindings::Signal< Args >::emit().
|
inlineexplicitnoexcept |
Constructs a Property from the provided value.
Definition at line 160 of file property.h.
|
delete |
Properties are not copyable.
|
inlinenoexcept |
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.
Definition at line 180 of file property.h.
|
inlineexplicit |
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.
Definition at line 238 of file property.h.
|
inline |
Returns a Signal that will be emitted when this Property is destructed.
Definition at line 301 of file property.h.
|
inline |
Returns the value represented by this Property.
Definition at line 335 of file property.h.
Referenced by KDBindings::Property< T >::operator()().
|
inlinenoexcept |
Returns true if this Property has a binding associated with it.
Definition at line 306 of file property.h.
|
inline |
Returns the value represented by this Property.
See: get().
Definition at line 356 of file property.h.
References KDBindings::Property< T >::get().
|
inlinenoexcept |
See: Property(Property<T> &&other)
Definition at line 206 of file property.h.
|
delete |
|
inline |
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.
Definition at line 255 of file property.h.
|
inline |
Assigns a new value to this Property.
See: set().
Definition at line 345 of file property.h.
References KDBindings::Property< T >::set().
|
inline |
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.
Definition at line 278 of file property.h.
|
inline |
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.
ReadOnlyProperty | If the Property has a PropertyUpdater associated with it (i.e. it is the result of a binding expression). |
Definition at line 322 of file property.h.
Referenced by KDBindings::Property< T >::operator=(), and KDBindings::operator>>().
|
inline |
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.
Definition at line 289 of file property.h.
|
inline |
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.
Definition at line 296 of file property.h.