![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
\inmodule QtCore More...
#include <qproperty.h>
Public Member Functions | |
| constexpr | QUntypedBindable ()=default |
| Default-constructs a QUntypedBindable. | |
| template<typename Property> | |
| QUntypedBindable (Property *p) | |
| Constructs a QUntypedBindable from the property property. | |
| bool | isValid () const |
| Returns true if the QUntypedBindable is valid. | |
| bool | isBindable () const |
| bool | isReadOnly () const |
| QUntypedPropertyBinding | makeBinding (const QPropertyBindingSourceLocation &location=QT_PROPERTY_DEFAULT_BINDING_LOCATION) const |
| Creates a binding returning the underlying properties' value, using a specified source location. | |
| QUntypedPropertyBinding | takeBinding () |
| Removes the currently set binding from the property and returns it. | |
| void | observe (QPropertyObserver *observer) const |
| template<typename Functor> | |
| QPropertyChangeHandler< Functor > | onValueChanged (Functor f) const |
| Installs f as a change handler. | |
| template<typename Functor> | |
| QPropertyChangeHandler< Functor > | subscribe (Functor f) const |
Behaves like a call to f followed by onValueChanged(f),. | |
| template<typename Functor> | |
| QPropertyNotifier | addNotifier (Functor f) |
| Installs f as a change handler. | |
| QUntypedPropertyBinding | binding () const |
| Returns the underlying property's binding if there is any, or a default constructed QUntypedPropertyBinding otherwise. | |
| bool | setBinding (const QUntypedPropertyBinding &binding) |
| Sets the underlying property's binding to binding. | |
| bool | hasBinding () const |
Returns true if the underlying property has a binding. | |
| QMetaType | metaType () const |
Protected Member Functions | |
| constexpr | QUntypedBindable (QUntypedPropertyData *d, const QtPrivate::QBindableInterface *i) |
| Q_CORE_EXPORT | QUntypedBindable (QObject *obj, const QMetaProperty &property, const QtPrivate::QBindableInterface *i) |
| Q_CORE_EXPORT | QUntypedBindable (QObject *obj, const char *property, const QtPrivate::QBindableInterface *i) |
Protected Attributes | |
| QUntypedPropertyData * | data = nullptr |
| const QtPrivate::QBindableInterface * | iface = nullptr |
Friends | |
| struct | QUntypedBindablePrivate |
\inmodule QtCore
QUntypedBindable is a uniform interface over bindable properties like QProperty<T> and QObjectBindableProperty of any type T.
QUntypedBindable is a fully type-erased generic interface to wrap bindable properties. You can use it to interact with properties without knowing their type nor caring what kind of bindable property they are (e.g. QProperty or QObjectBindableProperty). For most use cases, using QBindable<T> (which is generic over the property implementation but has a fixed type) should be preferred.
Definition at line 730 of file qproperty.h.
|
inlineconstexprprotected |
Definition at line 736 of file qproperty.h.
References QUntypedBindable(), and iface.
Referenced by QUntypedBindable().
|
explicitprotected |
Definition at line 2634 of file qproperty.cpp.
References iface.
|
explicitprotected |
Definition at line 2686 of file qproperty.cpp.
|
constexprdefault |
Constructs a QUntypedBindable from the property property.
If Property is const, the QUntypedBindable will be read only. If property is null, the QUntypedBindable will be invalid.
Definition at line 746 of file qproperty.h.
References QUntypedBindable().
Referenced by QUntypedBindable().
|
inline |
Installs f as a change handler.
Whenever the underlying property changes, f will be called, as long as the returned QPropertyNotifier and the property are kept alive.
This method is in some cases easier to use than onValueChanged(), as the returned object is not a template. It can therefore more easily be stored, e.g. as a member in a class.
Definition at line 804 of file qproperty.h.
References observe().
|
inline |
Returns the underlying property's binding if there is any, or a default constructed QUntypedPropertyBinding otherwise.
Definition at line 811 of file qproperty.h.
References iface, isBindable(), QtPrivate::BindableWarnings::NonBindableInterface, and QtPrivate::BindableWarnings::printUnsuitableBindableWarning().
|
inline |
Returns true if the underlying property has a binding.
Definition at line 841 of file qproperty.h.
|
inline |
Returns true if the underlying property's binding can be queried with binding() and, if not read-only, changed with setBinding. Only QObjectComputedProperty currently leads to this method returning false.
Definition at line 752 of file qproperty.h.
References iface.
Referenced by binding().
|
inline |
Returns true if the QUntypedBindable is read-only.
Definition at line 753 of file qproperty.h.
References iface, and QtPrivate::QBindableInterface::setObserver.
Referenced by setBinding().
|
inline |
Returns true if the QUntypedBindable is valid.
Methods called on an invalid QUntypedBindable generally have no effect, unless otherwise noted.
Definition at line 751 of file qproperty.h.
|
inline |
Creates a binding returning the underlying properties' value, using a specified source location.
Definition at line 755 of file qproperty.h.
References iface.
|
inline |
Returns the metatype of the property from which the QUntypedBindable was created. If the bindable is invalid, an invalid metatype will be returned.
Definition at line 846 of file qproperty.h.
References QtPrivate::QBindableInterface::getter, and iface.
|
inline |
Installs the observer on the underlying property.
Definition at line 777 of file qproperty.h.
References iface, QtPrivate::BindableWarnings::InvalidInterface, QtPrivate::BindableWarnings::printUnsuitableBindableWarning(), and QtPrivate::QBindableInterface::setObserver.
Referenced by addNotifier(), and onValueChanged().
|
inline |
Installs f as a change handler.
Whenever the underlying property changes, f will be called, as long as the returned QPropertyChangeHandler and the property are kept alive. On each value change, the handler is either called immediately, or deferred, depending on the context.
Definition at line 789 of file qproperty.h.
References observe().
|
inline |
Sets the underlying property's binding to binding.
This does not have any effect if the QUntypedBindable is read-only, null or if binding's type does match the underlying property's type.
true when the binding was successfully set.Definition at line 822 of file qproperty.h.
References iface, QtPrivate::BindableWarnings::InvalidInterface, isReadOnly(), QtPrivate::BindableWarnings::printMetaTypeMismatch(), QtPrivate::BindableWarnings::printUnsuitableBindableWarning(), and QtPrivate::BindableWarnings::ReadOnlyInterface.
|
inline |
Behaves like a call to f followed by onValueChanged(f),.
Definition at line 797 of file qproperty.h.
|
inline |
Removes the currently set binding from the property and returns it.
Returns a default-constructed QUntypedPropertyBinding if no binding is set.
Definition at line 760 of file qproperty.h.
References iface.
|
friend |
Definition at line 732 of file qproperty.h.
|
protected |
Definition at line 734 of file qproperty.h.
|
protected |
Definition at line 735 of file qproperty.h.
Referenced by QBindable< T >::QBindable(), QUntypedBindable(), QUntypedBindable(), binding(), QUntypedBindablePrivate::getInterface(), isBindable(), isReadOnly(), makeBinding(), metaType(), observe(), QBindable< T >::setBinding(), setBinding(), QBindable< T >::setValue(), takeBinding(), and QBindable< T >::value().