diff options
author | Martin Jones <martin.jones@nokia.com> | 2009-11-18 23:59:28 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2009-11-18 23:59:28 (GMT) |
commit | bb8c3d4f8f064bf53b22d85f875c8adffc2591c0 (patch) | |
tree | 8bda2cde10de4e62a827c4f4c39b159e4d63de86 /src/declarative | |
parent | 0379a7763311ce20fe077c508e15ac5249edd35f (diff) | |
download | Qt-bb8c3d4f8f064bf53b22d85f875c8adffc2591c0.zip Qt-bb8c3d4f8f064bf53b22d85f875c8adffc2591c0.tar.gz Qt-bb8c3d4f8f064bf53b22d85f875c8adffc2591c0.tar.bz2 |
'when' property has to be before 'value' property in Binding element
Task-number: QTBUG-5477
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/util/qmlbind.cpp | 14 | ||||
-rw-r--r-- | src/declarative/util/qmlbind_p.h | 7 |
2 files changed, 16 insertions, 5 deletions
diff --git a/src/declarative/util/qmlbind.cpp b/src/declarative/util/qmlbind.cpp index b8ab53e..2f692d8 100644 --- a/src/declarative/util/qmlbind.cpp +++ b/src/declarative/util/qmlbind.cpp @@ -55,9 +55,10 @@ QT_BEGIN_NAMESPACE class QmlBindPrivate : public QObjectPrivate { public: - QmlBindPrivate() : when(true), obj(0) {} + QmlBindPrivate() : when(true), componentComplete(false), obj(0) {} - bool when; + bool when : 1; + bool componentComplete : 1; QObject *obj; QString prop; QmlNullableValue<QVariant> value; @@ -176,10 +177,17 @@ void QmlBind::setValue(const QVariant &v) eval(); } +void QmlBind::componentComplete() +{ + Q_D(QmlBind); + d->componentComplete = true; + eval(); +} + void QmlBind::eval() { Q_D(QmlBind); - if (!d->obj || d->value.isNull || !d->when) + if (!d->obj || d->value.isNull || !d->when || !d->componentComplete) return; QmlMetaProperty prop(d->obj, d->prop); diff --git a/src/declarative/util/qmlbind_p.h b/src/declarative/util/qmlbind_p.h index a9b7b98..4d85698 100644 --- a/src/declarative/util/qmlbind_p.h +++ b/src/declarative/util/qmlbind_p.h @@ -52,11 +52,11 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QmlBindPrivate; -class Q_DECLARATIVE_EXPORT QmlBind : public QObject +class Q_DECLARATIVE_EXPORT QmlBind : public QObject, public QmlParserStatus { Q_OBJECT Q_DECLARE_PRIVATE(QmlBind) - + Q_INTERFACES(QmlParserStatus) Q_PROPERTY(QObject *target READ object WRITE setObject) Q_PROPERTY(QString property READ property WRITE setProperty) Q_PROPERTY(QVariant value READ value WRITE setValue) @@ -78,6 +78,9 @@ public: QVariant value() const; void setValue(const QVariant &); +protected: + virtual void componentComplete(); + private: void eval(); }; |