Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QQmlBinding Class Referenceabstract

#include <qqmlbinding_p.h>

+ Inheritance diagram for QQmlBinding:
+ Collaboration diagram for QQmlBinding:

Public Types

enum  { Invalid = -1 }
 
typedef QExplicitlySharedDataPointer< QQmlBindingPtr
 
typedef int Identifier
 
- Public Types inherited from QQmlAbstractBinding
enum  Kind { ValueTypeProxy , QmlBinding , PropertyToPropertyBinding }
 
enum  TargetTag { NoTargetTag = 0x0 , UpdatingBinding = 0x1 , BindingEnabled = 0x2 }
 
enum  NextBindingTag { NoBindingTag = 0x0 , AddedToObject = 0x1 , CanUseAccessor = 0x2 }
 
typedef QExplicitlySharedDataPointer< QQmlAbstractBindingPtr
 

Public Member Functions

Kind kind () const final
 
 ~QQmlBinding () override
 
bool mustCaptureBindableProperty () const final
 
void refresh () override
 
void setEnabled (bool, QQmlPropertyData::WriteFlags flags=QQmlPropertyData::DontRemoveBinding) override
 
QString expression () const override
 
void update (QQmlPropertyData::WriteFlags flags=QQmlPropertyData::DontRemoveBinding)
 
QVariant evaluate ()
 
bool evaluate (void *result, QMetaType type)
 
void expressionChanged () override
 
QQmlSourceLocation sourceLocation () const override
 
void setSourceLocation (const QQmlSourceLocation &location)
 
void setBoundFunction (QV4::BoundFunction *boundFunction)
 
bool hasBoundFunction () const
 
QVector< QQmlPropertydependencies () const
 
virtual bool hasDependencies () const
 
- Public Member Functions inherited from QQmlJavaScriptExpression
 QQmlJavaScriptExpression ()
 
virtual ~QQmlJavaScriptExpression ()
 
virtual QString expressionIdentifier () const
 
QV4::ReturnedValue evaluate (bool *isUndefined)
 
QV4::ReturnedValue evaluate (QV4::CallData *callData, bool *isUndefined)
 
bool evaluate (void **a, const QMetaType *types, int argc)
 
bool notifyOnValueChanged () const
 
void setNotifyOnValueChanged (bool v)
 
void resetNotifyOnValueChanged ()
 
QObjectscopeObject () const
 
void setScopeObject (QObject *v)
 
bool hasContext () const
 
bool hasValidContext () const
 
QQmlContextpublicContext () const
 
QQmlRefPointer< QQmlContextDatacontext () const
 
void setContext (const QQmlRefPointer< QQmlContextData > &context)
 
void insertIntoList (QQmlJavaScriptExpression **listHead)
 
QV4::Functionfunction () const
 
bool hasError () const
 
bool hasDelayedError () const
 
QQmlError error (QQmlEngine *) const
 
void clearError ()
 
void clearActiveGuards ()
 
QQmlDelayedErrordelayedError ()
 
QQmlEngineengine () const
 
bool hasUnresolvedNames () const
 
bool needsPropertyChangeTrigger (QObject *target, int propertyIndex)
 
QPropertyChangeTriggerallocatePropertyChangeTrigger (QObject *target, int propertyIndex)
 
- Public Member Functions inherited from QQmlAbstractBinding
virtual ~QQmlAbstractBinding ()
 
QQmlPropertyIndex targetPropertyIndex () const
 
QObjecttargetObject () const
 
void setTarget (const QQmlProperty &)
 
bool setTarget (QObject *, const QQmlPropertyData &, const QQmlPropertyData *valueType)
 
bool setTarget (QObject *, int coreIndex, bool coreIsAlias, int valueTypeIndex)
 
void addToObject ()
 Add this binding to object.
 
void removeFromObject ()
 Remove the binding from the object.
 
QQmlAbstractBindingnextBinding () const
 
bool canUseAccessor () const
 
void setCanUseAccessor (bool canUseAccessor)
 

Static Public Member Functions

static QQmlBindingcreate (const QQmlPropertyData *, const QQmlScriptString &, QObject *, QQmlContext *)
 
static QQmlBindingcreate (const QQmlPropertyData *, const QString &, QObject *, const QQmlRefPointer< QQmlContextData > &, const QString &url=QString(), quint16 lineNumber=0)
 
static QQmlBindingcreate (const QQmlPropertyData *property, QV4::Function *function, QObject *obj, const QQmlRefPointer< QQmlContextData > &ctxt, QV4::ExecutionContext *scope)
 
static QQmlBindingcreate (QMetaType propertyType, QV4::Function *function, QObject *obj, const QQmlRefPointer< QQmlContextData > &ctxt, QV4::ExecutionContext *scope)
 
static QQmlBindingcreateTranslationBinding (const QQmlRefPointer< QV4::ExecutableCompilationUnit > &unit, const QV4::CompiledData::Binding *binding, QObject *obj, const QQmlRefPointer< QQmlContextData > &ctxt)
 
static QQmlBindingcreateTranslationBinding (const QQmlRefPointer< QV4::ExecutableCompilationUnit > &unit, const QQmlRefPointer< QQmlContextData > &ctxt, const QString &propertyName, const QQmlTranslation &translationData, const QQmlSourceLocation &location, QObject *obj)
 
- Static Public Member Functions inherited from QQmlJavaScriptExpression
static QV4::ReturnedValue evalFunction (const QQmlRefPointer< QQmlContextData > &ctxt, QObject *scope, const QString &code, const QString &filename, quint16 line)
 
- Static Public Member Functions inherited from QQmlAbstractBinding
static void printBindingLoopError (const QQmlProperty &prop)
 

Protected Member Functions

virtual void doUpdate (const DeleteWatcher &watcher, QQmlPropertyData::WriteFlags flags, QV4::Scope &scope)
 
virtual bool write (const QV4::Value &result, bool isUndefined, QQmlPropertyData::WriteFlags flags)=0
 
virtual bool write (void *result, QMetaType type, bool isUndefined, QQmlPropertyData::WriteFlags flags)=0
 
int getPropertyType () const
 
bool slowWrite (const QQmlPropertyData &core, const QQmlPropertyData &valueTypeData, const QV4::Value &result, bool isUndefined, QQmlPropertyData::WriteFlags flags)
 
bool slowWrite (const QQmlPropertyData &core, const QQmlPropertyData &valueTypeData, const void *result, QMetaType resultType, bool isUndefined, QQmlPropertyData::WriteFlags flags)
 
QV4::ReturnedValue evaluate (bool *isUndefined)
 
- Protected Member Functions inherited from QQmlJavaScriptExpression
void createQmlBinding (const QQmlRefPointer< QQmlContextData > &ctxt, QObject *scope, const QString &code, const QString &filename, quint16 line)
 
void setupFunction (QV4::ExecutionContext *qmlContext, QV4::Function *f)
 
void setCompilationUnit (const QQmlRefPointer< QV4::ExecutableCompilationUnit > &compilationUnit)
 
- Protected Member Functions inherited from QQmlAbstractBinding
 QQmlAbstractBinding ()
 
void setAddedToObject (bool v)
 
bool isAddedToObject () const
 
void setNextBinding (QQmlAbstractBinding *)
 
void getPropertyData (const QQmlPropertyData **propertyData, QQmlPropertyData *valueTypeData) const
 
bool updatingFlag () const
 
void setUpdatingFlag (bool)
 
bool enabledFlag () const
 
void setEnabledFlag (bool)
 
void updateCanUseAccessor ()
 

Friends

class QQmlAbstractBinding
 

Additional Inherited Members

- Public Attributes inherited from QQmlAbstractBinding
RefCount ref
 
- Protected Types inherited from QQmlJavaScriptExpression
enum  GuardTag { NoGuardTag , NotifyOnValueChanged }
 
enum  Tag { NoTag , InEvaluationLoop }
 
- Protected Attributes inherited from QQmlJavaScriptExpression
QBiPointer< QObject, DeleteWatcherm_scopeObject
 
QForwardFieldList< QQmlJavaScriptExpressionGuard, &QQmlJavaScriptExpressionGuard::next, GuardTagactiveGuards
 
QTaggedPointer< QQmlDelayedError, Tagm_error
 
TriggerListqpropertyChangeTriggers = nullptr
 
- Protected Attributes inherited from QQmlAbstractBinding
QQmlPropertyIndex m_targetIndex
 
QTaggedPointer< QObject, TargetTags > m_target
 
QTaggedPointer< QQmlAbstractBinding, NextBindingTags > m_nextBinding
 

Detailed Description

Definition at line 32 of file qqmlbinding_p.h.

Member Typedef Documentation

◆ Identifier

Definition at line 76 of file qqmlbinding_p.h.

◆ Ptr

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
Invalid 

Definition at line 77 of file qqmlbinding_p.h.

Constructor & Destructor Documentation

◆ ~QQmlBinding()

QQmlBinding::~QQmlBinding ( )
override

Definition at line 127 of file qqmlbinding.cpp.

Member Function Documentation

◆ create() [1/4]

QT_BEGIN_NAMESPACE QQmlBinding * QQmlBinding::create ( const QQmlPropertyData * property,
const QQmlScriptString & script,
QObject * obj,
QQmlContext * ctxt )
static

Definition at line 35 of file qqmlbinding.cpp.

References QV4::QmlContext::create(), engine, QQmlContextData::get(), QQmlEnginePrivate::get(), Invalid, property, qmlContext(), QV4::ExecutionEngine::rootContext(), and url.

Referenced by QQuickAnchorChanges::actions(), QQuickPropertyChanges::actions(), QQuickPropertyChanges::changeExpression(), QQmlCppBinding::createBindingForNonBindable(), QQmlAnyBinding::createFromCodeString(), QQmlAnyBinding::createFromFunction(), QQmlAnyBinding::createFromScriptString(), QV4::QObjectWrapper::setProperty(), and QV4::QQmlValueTypeWrapper::virtualPut().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create() [2/4]

QQmlBinding * QQmlBinding::create ( const QQmlPropertyData * property,
const QString & str,
QObject * obj,
const QQmlRefPointer< QQmlContextData > & ctxt,
const QString & url = QString(),
quint16 lineNumber = 0 )
static

Definition at line 89 of file qqmlbinding.cpp.

References property, str, and url.

◆ create() [3/4]

QQmlBinding * QQmlBinding::create ( const QQmlPropertyData * property,
QV4::Function * function,
QObject * obj,
const QQmlRefPointer< QQmlContextData > & ctxt,
QV4::ExecutionContext * scope )
static

Definition at line 104 of file qqmlbinding.cpp.

References create(), QQmlJavaScriptExpression::function(), and property.

+ Here is the call graph for this function:

◆ create() [4/4]

QQmlBinding * QQmlBinding::create ( QMetaType propertyType,
QV4::Function * function,
QObject * obj,
const QQmlRefPointer< QQmlContextData > & ctxt,
QV4::ExecutionContext * scope )
static

Definition at line 111 of file qqmlbinding.cpp.

References Q_ASSERT.

◆ createTranslationBinding() [1/2]

QQmlBinding * QQmlBinding::createTranslationBinding ( const QQmlRefPointer< QV4::ExecutableCompilationUnit > & unit,
const QQmlRefPointer< QQmlContextData > & ctxt,
const QString & propertyName,
const QQmlTranslation & translationData,
const QQmlSourceLocation & location,
QObject * obj )
static

◆ createTranslationBinding() [2/2]

QQmlBinding * QQmlBinding::createTranslationBinding ( const QQmlRefPointer< QV4::ExecutableCompilationUnit > & unit,
const QV4::CompiledData::Binding * binding,
QObject * obj,
const QQmlRefPointer< QQmlContextData > & ctxt )
static

Definition at line 371 of file qqmlbinding.cpp.

References QQmlJavaScriptExpression::QQmlTranslationBindingFromBinding.

Referenced by QQuickPropertyChanges::actions(), and QQmlCppBinding::createTranslationBindingForNonBindable().

+ Here is the caller graph for this function:

◆ dependencies()

QVector< QQmlProperty > QQmlBinding::dependencies ( ) const

This method returns a snapshot of the currently tracked dependencies of this binding. The dependencies can change upon reevaluation. This method is used in GammaRay to visualize binding hierarchies.

Call this method from the UI thread.

Definition at line 629 of file qqmlbinding.cpp.

References QQmlJavaScriptExpression::activeGuards, QTaggedPointer< T, Tag >::data(), dependencies(), QForwardFieldList< N, nextMember, Tag >::first(), QString::fromUtf8(), i, QMetaProperty::isValid(), QQmlAbstractBinding::m_target, QMetaProperty::name(), QForwardFieldList< N, nextMember, Tag >::next(), TriggerList::next, property, QQmlJavaScriptExpression::qpropertyChangeTriggers, and QMetaObjectPrivate::signal().

Referenced by dependencies().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doUpdate()

void QQmlBinding::doUpdate ( const DeleteWatcher & watcher,
QQmlPropertyData::WriteFlags flags,
QV4::Scope & scope )
protectedvirtual

◆ evaluate() [1/3]

QVariant QQmlBinding::evaluate ( )

Definition at line 587 of file qqmlbinding.cpp.

References QQmlEnginePrivate::dereferenceScarceResources(), QQmlJavaScriptExpression::engine(), QQmlJavaScriptExpression::evaluate(), QMetaType::fromType(), QQmlEnginePrivate::get(), QJSEngine::handle(), qmlEngine(), QQmlEnginePrivate::referenceScarceResources(), and QV4::ExecutionEngine::toVariant().

Referenced by doUpdate(), QQmlBind::setObject(), and QQuickStateGroupPrivate::updateAutoState().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ evaluate() [2/3]

QV4::ReturnedValue QQmlBinding::evaluate ( bool * isUndefined)
protected

Definition at line 170 of file qqmlbinding.cpp.

References args, QList< T >::data(), QQmlJavaScriptExpression::engine(), QQmlJavaScriptExpression::evaluate(), QJSEngine::handle(), QList< T >::size(), and QV4::PersistentValue::valueRef().

+ Here is the call graph for this function:

◆ evaluate() [3/3]

bool QQmlBinding::evaluate ( void * result,
QMetaType type )
inline

Definition at line 82 of file qqmlbinding_p.h.

References QQmlJavaScriptExpression::evaluate().

+ Here is the call graph for this function:

◆ expression()

QString QQmlBinding::expression ( ) const
overridevirtual

Reimplemented from QQmlAbstractBinding.

Definition at line 624 of file qqmlbinding.cpp.

References QStringLiteral.

◆ expressionChanged()

void QQmlBinding::expressionChanged ( )
overridevirtual

Implements QQmlJavaScriptExpression.

Definition at line 603 of file qqmlbinding.cpp.

References update().

+ Here is the call graph for this function:

◆ getPropertyType()

int QQmlBinding::getPropertyType ( ) const
protected

◆ hasBoundFunction()

bool QQmlBinding::hasBoundFunction ( ) const
inline

Definition at line 94 of file qqmlbinding_p.h.

Referenced by doUpdate().

+ Here is the caller graph for this function:

◆ hasDependencies()

bool QQmlBinding::hasDependencies ( ) const
virtual

Reimplemented in QQmlTranslationBinding.

Definition at line 664 of file qqmlbinding.cpp.

References QQmlJavaScriptExpression::activeGuards, QForwardFieldList< N, nextMember, Tag >::isEmpty(), and QQmlJavaScriptExpression::qpropertyChangeTriggers.

Referenced by QQmlObjectCreator::finalize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ kind()

Kind QQmlBinding::kind ( ) const
inlinefinalvirtual

Implements QQmlAbstractBinding.

Definition at line 65 of file qqmlbinding_p.h.

References QQmlAbstractBinding::QmlBinding.

◆ mustCaptureBindableProperty()

bool QQmlBinding::mustCaptureBindableProperty ( ) const
inlinefinalvirtual

Reimplemented from QQmlJavaScriptExpression.

Definition at line 69 of file qqmlbinding_p.h.

◆ refresh()

void QQmlBinding::refresh ( )
overridevirtual

Reimplemented from QQmlJavaScriptExpression.

Definition at line 608 of file qqmlbinding.cpp.

References update().

+ Here is the call graph for this function:

◆ setBoundFunction()

void QQmlBinding::setBoundFunction ( QV4::BoundFunction * boundFunction)
inline

Definition at line 91 of file qqmlbinding_p.h.

Referenced by QV4::QObjectWrapper::setProperty(), and QV4::QQmlValueTypeWrapper::virtualPut().

+ Here is the caller graph for this function:

◆ setEnabled()

void QQmlBinding::setEnabled ( bool e,
QQmlPropertyData::WriteFlags flags = QQmlPropertyData::DontRemoveBinding )
overridevirtual

Implements QQmlAbstractBinding.

Definition at line 613 of file qqmlbinding.cpp.

References QQmlAbstractBinding::enabledFlag(), QQmlAbstractBinding::setEnabledFlag(), QQmlJavaScriptExpression::setNotifyOnValueChanged(), update(), and QQmlAbstractBinding::updateCanUseAccessor().

+ Here is the call graph for this function:

◆ setSourceLocation()

void QQmlBinding::setSourceLocation ( const QQmlSourceLocation & location)

Definition at line 81 of file qqmlbinding.cpp.

Referenced by QV4::QObjectWrapper::setProperty(), and QV4::QQmlValueTypeWrapper::virtualPut().

+ Here is the caller graph for this function:

◆ slowWrite() [1/2]

Q_NEVER_INLINE bool QQmlBinding::slowWrite ( const QQmlPropertyData & core,
const QQmlPropertyData & valueTypeData,
const QV4::Value & result,
bool isUndefined,
QQmlPropertyData::WriteFlags flags )
protected

◆ slowWrite() [2/2]

◆ sourceLocation()

QQmlSourceLocation QQmlBinding::sourceLocation ( ) const
overridevirtual

Reimplemented from QQmlJavaScriptExpression.

Reimplemented in QQmlTranslationBindingFromBinding, and QQmlTranslationBindingFromTranslationInfo.

Definition at line 74 of file qqmlbinding.cpp.

References QQmlJavaScriptExpression::sourceLocation().

Referenced by doUpdate(), and update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

◆ write() [1/2]

virtual bool QQmlBinding::write ( const QV4::Value & result,
bool isUndefined,
QQmlPropertyData::WriteFlags flags )
protectedpure virtual

Implemented in GenericBinding< StaticPropType >, GenericBinding< QMetaType::QString >, and QObjectPointerBinding.

Referenced by doUpdate().

+ Here is the caller graph for this function:

◆ write() [2/2]

virtual bool QQmlBinding::write ( void * result,
QMetaType type,
bool isUndefined,
QQmlPropertyData::WriteFlags flags )
protectedpure virtual

Friends And Related Symbol Documentation

◆ QQmlAbstractBinding

friend class QQmlAbstractBinding
friend

Definition at line 35 of file qqmlbinding_p.h.


The documentation for this class was generated from the following files: