QUntypedBindable Class | Qt Core (original) (raw)

QUntypedBindable is a uniform interface over bindable properties like QProperty\<T\> and QObjectBindableProperty of any type T. More...

Member Function Documentation

[constexpr noexcept] QUntypedBindable::QUntypedBindable()

Default-constructs a QUntypedBindable. It is in an invalid state.

See also isValid().

template QUntypedBindable::QUntypedBindable(Property *property)

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.

See also isValid() and isReadOnly().

template QPropertyNotifier QUntypedBindable::addNotifier(Functor f)

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.

See also onValueChanged() and subscribe().

QUntypedPropertyBinding QUntypedBindable::binding() const

Returns the underlying property's binding if there is any, or a default constructed QUntypedPropertyBinding otherwise.

See also setBinding() and hasBinding().

bool QUntypedBindable::hasBinding() const

Returns true if the underlying property has a binding.

[since 6.1] bool QUntypedBindable::isReadOnly() const

Returns true if the QUntypedBindable is read-only.

This function was introduced in Qt 6.1.

bool QUntypedBindable::isValid() const

Returns true if the QUntypedBindable is valid. Methods called on an invalid QUntypedBindable generally have no effect, unless otherwise noted.

QUntypedPropertyBinding QUntypedBindable::makeBinding(const QPropertyBindingSourceLocation &location = QT_PROPERTY_DEFAULT_BINDING_LOCATION) const

Creates a binding returning the underlying properties' value, using a specified source location.

[since 6.2] QMetaType QUntypedBindable::metaType() const

Returns the metatype of the property from which the QUntypedBindable was created. If the bindable is invalid, an invalid metatype will be returned.

This function was introduced in Qt 6.2.

See also isValid().

template QPropertyChangeHandler<Functor> QUntypedBindable::onValueChanged(Functor f) const

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.

See also onValueChanged() and subscribe().

bool QUntypedBindable::setBinding(const QUntypedPropertyBinding &binding)

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.

Returns true when the binding was successfully set.

See also binding().

template QPropertyChangeHandler<Functor> QUntypedBindable::subscribe(Functor f) const

Behaves like a call to f followed by onValueChanged(f),

See also onValueChanged().

[since 6.1] QUntypedPropertyBinding QUntypedBindable::takeBinding()

Removes the currently set binding from the property and returns it. Returns a default-constructed QUntypedPropertyBinding if no binding is set.

This function was introduced in Qt 6.1.