![]() |
Qt 6.x
The Qt SDK
|
QQmlAnyBinding is an abstraction over the various bindings in QML. More...
#include <qqmlanybinding_p.h>
Public Types | |
enum | InterceptorMode : bool { IgnoreInterceptors , RespectInterceptors } |
Friends | |
void | swap (QQmlAnyBinding &lhs, QQmlAnyBinding &rhs) noexcept |
bool | operator== (const QQmlAnyBinding &p1, const QQmlAnyBinding &p2) |
bool | operator!= (const QQmlAnyBinding &p1, const QQmlAnyBinding &p2) |
QQmlAnyBinding is an abstraction over the various bindings in QML.
QQmlAnyBinding can store both classical bindings (derived from QQmlAbstractBinding) as well as new-style bindings (derived from QPropertyBindingPrivate). For both, it keeps a strong reference to them, and knows how to delete them in case the reference count becomes zero. In that sense it can be thought of as a union of QUntypedPropertyBinding and QQmlAbstractBinding::Ptr.
It also offers methods to create bindings (from QV4::Function, from translation bindings and from code strings). Moreover, it allows the retrieval, the removal and the installation of bindings on a QQmlProperty.
Note that the class intentionally does not allow construction from QUntypedProperty and QQmlAbstractBinding::Ptr. This is meant to catch code which doesn't handle bindable properties yet when porting existing code.
Definition at line 44 of file qqmlanybinding_p.h.
enum QQmlAnyBinding::InterceptorMode : bool |
Installs the binding referenced by this QQmlAnyBinding on the target. If mode is set to RespectInterceptors, interceptors are honored, otherwise writes and binding installation bypass them (the default). Preconditions:
Enumerator | |
---|---|
IgnoreInterceptors | |
RespectInterceptors |
Definition at line 226 of file qqmlanybinding_p.h.
|
constexprdefaultnoexcept |
|
inline |
Definition at line 48 of file qqmlanybinding_p.h.
|
inlinenoexcept |
Definition at line 421 of file qqmlanybinding_p.h.
|
inlinenoexcept |
Definition at line 425 of file qqmlanybinding_p.h.
References other().
|
inlinenoexcept |
Definition at line 451 of file qqmlanybinding_p.h.
Referenced by QQmlBindEntryContent::destroy().
|
inline |
Returns the stored QQmlAbstractBinding. If no such binding is currently stored, a null pointer is returned.
Definition at line 320 of file qqmlanybinding_p.h.
References QBiPointer< T, T2 >::asT1(), QBiPointer< T, T2 >::isNull(), and QBiPointer< T, T2 >::isT2().
Referenced by QQuickPropertyChanges::changeExpression(), hasError(), and installOn().
|
inline |
Returns the stored QPropertyBindingPrivate as a QUntypedPropertyBinding. If no such binding is currently stored, a null QUntypedPropertyBinding is returned.
Definition at line 307 of file qqmlanybinding_p.h.
References QBiPointer< T, T2 >::asT2(), QBiPointer< T, T2 >::isNull(), QBiPointer< T, T2 >::isT1(), and priv().
Referenced by hasError(), and installOn().
|
inlinestatic |
Creates a binding for property prop from function. obj is the scope object which shall be used for the function and scope its QML scope. The binding is not installed on the property (but if a QQmlBinding is created, it has its target set to prop).
Definition at line 180 of file qqmlanybinding_p.h.
References QQmlBinding::create(), QQmlPropertyBinding::createFromCodeString(), QQmlPropertyPrivate::get(), QQmlProperty::isBindable(), QQmlProperty::object, and url.
Referenced by QQuickPropertyChanges::actions(), QQuickPropertyChanges::changeExpression(), and createBinding().
|
inlinestatic |
Creates a binding for property prop from function. obj is the scope object which shall be used for the function and scope its QML scope. The binding is not installed on the property (but if a QQmlBinding is created, it has its target set to prop).
Definition at line 118 of file qqmlanybinding_p.h.
References QQmlBinding::create(), QQmlPropertyBinding::create(), function, QQmlPropertyPrivate::get(), QQmlProperty::isBindable(), and QQmlProperty::object.
Referenced by QQuickPropertyChanges::actions(), and createBinding().
|
inlinestatic |
Creates a binding for property prop from script. obj is the scope object which shall be used for the function and ctxt its QML scope. The binding is not installed on the property (but if a QQmlBinding is created, it has its target set to prop).
Definition at line 144 of file qqmlanybinding_p.h.
References QQmlBinding::create(), QQmlPropertyBinding::createFromScriptString(), QQmlPropertyPrivate::get(), QQmlProperty::isBindable(), and QQmlProperty::object.
Referenced by QQuickParentChange::actions().
|
inlinestatic |
Creates a translattion binding for prop from compilationUnit and transationBinding. obj is the context object, context the qml context.
Definition at line 202 of file qqmlanybinding_p.h.
Referenced by QQuickPropertyChanges::actions(), and createBinding().
|
inline |
Returns true if the binding is in an error state (e.g. binding loop), false otherwise.
Definition at line 261 of file qqmlanybinding_p.h.
References asAbstractBinding(), asUntypedPropertyBinding(), QUntypedPropertyBinding::error(), hasError(), QPropertyBindingError::hasError(), isAbstractPropertyBinding(), and QQmlAbstractBinding::QmlBinding.
Referenced by hasError().
|
inline |
Definition at line 231 of file qqmlanybinding_p.h.
References asAbstractBinding(), asUntypedPropertyBinding(), QMetaObject::BindableProperty, QQmlPropertyData::BypassInterceptor, QQmlPropertyPrivate::core, QQmlPropertyData::DontRemoveBinding, QQmlPropertyPrivate::get(), IgnoreInterceptors, isAbstractPropertyBinding(), QQmlPropertyData::isAlias(), QBiPointer< T, T2 >::isNull(), QMetaObject::metacall(), QQmlPropertyPrivate::None, Q_ASSERT, QUntypedBindable::setBinding(), and QQmlPropertyPrivate::setBinding().
Referenced by QQuickPropertyChanges::changeExpression(), QQmlBindPrivate::decodeBinding(), and QQDMIncubationTask::initializeRequiredProperties().
|
inline |
Returns true if a binding derived from QQmlAbstractPropertyBinding is stored. The binding migh still be null.
Definition at line 291 of file qqmlanybinding_p.h.
References QBiPointer< T, T2 >::isT1().
Referenced by QQuickStateAction::deleteFromBinding(), hasError(), and installOn().
|
inline |
Returns true if a binding derived from QPropertyBindingPrivate is stored. The binding might still be null.
Definition at line 299 of file qqmlanybinding_p.h.
References QBiPointer< T, T2 >::isT2().
|
inlinestatic |
Returns the binding of the property prop as a QQmlAnyBinding. The binding continues to be active and set on the property. If there was no binding set, the returned QQmlAnyBinding is null.
Definition at line 56 of file qqmlanybinding_p.h.
References QMetaProperty::bindable(), QUntypedBindable::binding(), QQmlPropertyPrivate::binding(), QQmlProperty::isBindable(), QQmlProperty::object, and QQmlProperty::property().
Referenced by QQuickSimpleAction::QQuickSimpleAction(), QQuickState::apply(), QQmlBind::setObject(), and QQuickStateGroupPrivate::updateAutoState().
|
inlinestatic |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.object must be non-null.
Definition at line 72 of file qqmlanybinding_p.h.
References QUntypedBindable::binding(), QQmlPropertyPrivate::binding(), QQmlData::get(), and Q_ASSERT.
|
inline |
Definition at line 282 of file qqmlanybinding_p.h.
References QBiPointer< T, T2 >::isNull().
|
inline |
Stores the binding stored in binding and keeps a reference to it.
Definition at line 367 of file qqmlanybinding_p.h.
References QExplicitlySharedDataPointer< T >::data(), QQmlAbstractBinding::RefCount::ref(), and QQmlAbstractBinding::ref.
|
inlinenoexcept |
Definition at line 431 of file qqmlanybinding_p.h.
References other().
|
inline |
Stores the binding stored in untypedBinding and keeps a reference to it.
Definition at line 394 of file qqmlanybinding_p.h.
References QPropertyBindingPrivate::get().
|
inline |
Stores binding and keeps a reference to it.
Definition at line 353 of file qqmlanybinding_p.h.
References QQmlAbstractBinding::RefCount::ref(), and QQmlAbstractBinding::ref.
|
inline |
Stores binding's binding, taking ownership from binding.
Definition at line 381 of file qqmlanybinding_p.h.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Stores the binding stored in untypedBinding, taking ownership from it.
Definition at line 410 of file qqmlanybinding_p.h.
References QPropertyBindingPrivate::get(), and ptr().
|
inline |
Stores a null binding.
For purpose of classification, the null bindings is treated as a QQmlAbstractPropertyBindings.
Definition at line 276 of file qqmlanybinding_p.h.
|
inline |
Reevaluates the binding. If the binding was disabled, it gets enabled.
Definition at line 332 of file qqmlanybinding_p.h.
References QBiPointer< T, T2 >::asT1(), QBiPointer< T, T2 >::asT2(), QBiPointer< T, T2 >::isNull(), QBiPointer< T, T2 >::isT1(), and refresh().
Referenced by refresh().
|
inlinestatic |
Removes the binding from prop if there is any.
Definition at line 165 of file qqmlanybinding_p.h.
References QMetaProperty::bindable(), QQmlProperty::isBindable(), QQmlProperty::object, QQmlProperty::property(), QQmlPropertyPrivate::removeBinding(), and QUntypedBindable::takeBinding().
Referenced by QQuickState::apply(), QQuickTransitionManager::cancel(), QQuickPropertyChanges::changeExpression(), QQmlBind::setDelayed(), and QQuickTransitionManager::transition().
|
inlinenoexcept |
Definition at line 428 of file qqmlanybinding_p.h.
References other(), and QBiPointer< T, T2 >::swap().
|
inlinestatic |
Removes the binding from the property prop, and returns it as a QQmlAnyBinding if there was any.
Otherwise returns a null QQmlAnyBinding.
Definition at line 94 of file qqmlanybinding_p.h.
References QMetaProperty::bindable(), QQmlPropertyPrivate::binding(), QQmlPropertyData::BypassInterceptor, QQmlPropertyData::DontRemoveBinding, QQmlProperty::isBindable(), QQmlProperty::object, QQmlProperty::property(), and QUntypedBindable::takeBinding().
Referenced by QQuickPropertyChanges::changeExpression().
|
friend |
Definition at line 446 of file qqmlanybinding_p.h.
|
friend |
Definition at line 441 of file qqmlanybinding_p.h.
|
friend |
Definition at line 429 of file qqmlanybinding_p.h.