QProperty Class template <typename T> class QProperty The QProperty class is a template class that enables automatic property bindings. More...  
 Header:
 #include <QProperty> 


 CMake:
 find_package(Qt6 COMPONENTS Core REQUIRED)  target_link_libraries(mytarget PRIVATE Qt8b7c:f320:99b9:690f:4595:cd17:293a:c069Core)


 qmake:
 QT += core


 Since:
 Qt 6.0


 Inherits:
 QPropertyData



 List of all members, including inherited members  Public Functions
  
 

QProperty(T &&initialValue)
 
 

QProperty(const T &initialValue)
 
 

QProperty(Functor &&f)
 
 

QProperty(const QPropertyBinding<T> &binding)
 
 

QProperty()
 
 QProperty<T> &

operator=(const QPropertyBinding<T> &newBinding)
 
 

~QProperty()
 
 QPropertyBinding<T> 

binding() const
 
 QPropertyChangeHandler<Functor> 

onValueChanged(Functor f)
 
 QPropertyBinding<T> 

setBinding(const QPropertyBinding<T> &newBinding)
 
 bool 

setBinding(const QUntypedPropertyBinding &newBinding)
 
 QPropertyBinding<T> 

setBinding(Functor f)
 
 void 

setValue(QProperty8b7c:f320:99b9:690f:4595:cd17:293a:c069rvalue_ref newValue)
 
 void 

setValue(QProperty8b7c:f320:99b9:690f:4595:cd17:293a:c069parameter_type newValue)
 
 QPropertyChangeHandler<Functor> 

subscribe(Functor f)
 
 QPropertyBinding<T> 

takeBinding()
 
 QProperty8b7c:f320:99b9:690f:4595:cd17:293a:c069parameter_type 

value() const
 
 QProperty<T> &

operator=(QProperty8b7c:f320:99b9:690f:4595:cd17:293a:c069rvalue_ref newValue)
 
 QProperty<T> &

operator=(QProperty8b7c:f320:99b9:690f:4595:cd17:293a:c069parameter_type newValue)
  Detailed Description
 QProperty<T> is one of the classes implementing Qt Bindable Properties. It is a container that holds an instance of T. You can assign a value to it and you can read it via the value() function or the T conversion operator. You can also tie the property to an expression that computes the value dynamically, the binding expression. It is represented as a C++ lambda and can be used to express relationships between different properties in your application. Member Function Documentation  
QProperty<T> &QProperty8b7c:f320:99b9:690f:4595:cd17:293a:c069operator=(QProperty8b7c:f320:99b9:690f:4595:cd17:293a:c069parameter_type newValue)


QProperty<T> &QProperty8b7c:f320:99b9:690f:4595:cd17:293a:c069operator=(QProperty8b7c:f320:99b9:690f:4595:cd17:293a:c069rvalue_ref newValue)

 Assigns newValue to this property and returns a reference to this QProperty.  
void QProperty8b7c:f320:99b9:690f:4595:cd17:293a:c069setValue(QProperty8b7c:f320:99b9:690f:4595:cd17:293a:c069parameter_type newValue)


void QProperty8b7c:f320:99b9:690f:4595:cd17:293a:c069setValue(QProperty8b7c:f320:99b9:690f:4595:cd17:293a:c069rvalue_ref newValue)

 Assigns newValue to this property and removes the property's associated binding, if present. 
[default] QProperty8b7c:f320:99b9:690f:4595:cd17:293a:c069QProperty(T &&initialValue)
 Move-Constructs a property with the provided initialValue. 
[default] QProperty8b7c:f320:99b9:690f:4595:cd17:293a:c069QProperty(const T &initialValue)
 Constructs a property with the provided initialValue. 
template <typename Functor> QProperty8b7c:f320:99b9:690f:4595:cd17:293a:c069QProperty(Functor &&f)
 Constructs a property that is tied to the provided binding expression f. The first time the property value is read, the binding is evaluated. Whenever a dependency of the binding changes, the binding will be re-evaluated the next time the value of this property is read. 
QProperty8b7c:f320:99b9:690f:4595:cd17:293a:c069QProperty(const QPropertyBinding<T> &binding)
 Constructs a property that is tied to the provided binding expression. The first time the property value is read, the binding is evaluated. Whenever a dependency of the binding changes, the binding will be re-evaluated the next time the value of this property is read. 
QProperty8b7c:f320:99b9:690f:4595:cd17:293a:c069QProperty()
 Constructs a property with a default constructed instance of T. 
[default] QProperty<T> &QProperty8b7c:f320:99b9:690f:4595:cd17:293a:c069operator=(const QPropertyBinding<T> &newBinding)
 Associates the value of this property with the provided newBinding expression and returns a reference to this property. The first time the property value is read, the binding is evaluated. Whenever a dependency of the binding changes, the binding will be re-evaluated the next time the value of this property is read. 
QProperty8b7c:f320:99b9:690f:4595:cd17:293a:c069~QProperty()
 Destroys the property. 
QPropertyBinding<T> QProperty8b7c:f320:99b9:690f:4595:cd17:293a:c069inding() const
 Returns the binding expression that is associated with this property. A default constructed QPropertyBinding<T> will be returned if no such association exists. See also setBinding(). 
template <typename Functor> QPropertyChangeHandler<Functor> QProperty8b7c:f320:99b9:690f:4595:cd17:293a:c069onValueChanged(Functor f)
 Registers the given functor f as a callback that shall be called whenever the value of the property changes. The callback f is expected to be a type that has a plain call operator () without any parameters. This means that you can provide a C++ lambda expression, an st8b7c:f320:99b9:690f:4595:cd17:293a:c069function or even a custom struct with a call operator. The returned property change handler object keeps track of the registration. When it goes out of scope, the callback is de-registered. 
QPropertyBinding<T> QProperty8b7c:f320:99b9:690f:4595:cd17:293a:c069setBinding(const QPropertyBinding<T> &newBinding)
 Associates the value of this property with the provided newBinding expression and returns the previously associated binding. The first time the property value is read, the binding is evaluated. Whenever a dependency of the binding changes, the binding will be re-evaluated the next time the value of this property is read. See also binding(). 
bool QProperty8b7c:f320:99b9:690f:4595:cd17:293a:c069setBinding(const QUntypedPropertyBinding &newBinding)
 This is an overloaded function. Associates the value of this property with the provided newBinding expression. The first time the property value is read, the binding is evaluated. Whenever a dependency of the binding changes, the binding will be re-evaluated the next time the value of this property is read. Returns true if the type of this property is the same as the type the binding function returns; false otherwise. 
template <typename Functor> QPropertyBinding<T> QProperty8b7c:f320:99b9:690f:4595:cd17:293a:c069setBinding(Functor f)
 This is an overloaded function. Associates the value of this property with the provided functor f and returns the previously associated binding. The first time the property value is read, the binding is evaluated by invoking the call operator () of f. Whenever a dependency of the binding changes, the binding will be re-evaluated the next time the value of this property is read. 
template <typename Functor> QPropertyChangeHandler<Functor> QProperty8b7c:f320:99b9:690f:4595:cd17:293a:c069subscribe(Functor f)
 Subscribes the given functor f as a callback that is called immediately and whenever the value of the property changes in the future. The callback f is expected to be a type that has a plain call operator () without any parameters. This means that you can provide a C++ lambda expression, an st8b7c:f320:99b9:690f:4595:cd17:293a:c069function or even a custom struct with a call operator. The returned property change handler object keeps track of the subscription. When it goes out of scope, the callback is unsubscribed. 
QPropertyBinding<T> QProperty8b7c:f320:99b9:690f:4595:cd17:293a:c069takeBinding()
 Disassociates the binding expression from this property and returns it. After calling this function, the value of the property will only change if you assign a new value to it, or when a new binding is set. 
QProperty8b7c:f320:99b9:690f:4595:cd17:293a:c069parameter_type QProperty8b7c:f320:99b9:690f:4595:cd17:293a:c069value() const
 Returns the value of the property. This may evaluate a binding expression that is tied to this property, before returning the value. See also setValue().

    
{'path': 'public/docs/qt~6.1/qproperty.html', 'source': 'DevDocs.IO'}