summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qdeclarativebinding_p.h
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-03-11 06:35:41 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-03-11 06:39:48 (GMT)
commit54bdab8b88777488f9f0d944698fbb155cf703af (patch)
tree3e143e77e22e68a13ca7fd81178899bdd91b0a30 /src/declarative/qml/qdeclarativebinding_p.h
parentfef9bb355f964f7a520da0c5e24d165644be1473 (diff)
downloadQt-54bdab8b88777488f9f0d944698fbb155cf703af.zip
Qt-54bdab8b88777488f9f0d944698fbb155cf703af.tar.gz
Qt-54bdab8b88777488f9f0d944698fbb155cf703af.tar.bz2
Improve value type binding behavior
Changing value type bindings in state changes, and implicitly removing them on property assignment was not reliable. Internally the system considered a binding on "font" and one on "font.x" as a binding on two separate properties, even though the "font" binding completely overrides the "font.x" property. Following this change a binding to "font.x" creates a proxy binding object on the "font" property in addition to the "font.x" binding itself. This allows behavior to be consistent across all operations. QT-2920
Diffstat (limited to 'src/declarative/qml/qdeclarativebinding_p.h')
-rw-r--r--src/declarative/qml/qdeclarativebinding_p.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/declarative/qml/qdeclarativebinding_p.h b/src/declarative/qml/qdeclarativebinding_p.h
index 1a714f0..21e3248 100644
--- a/src/declarative/qml/qdeclarativebinding_p.h
+++ b/src/declarative/qml/qdeclarativebinding_p.h
@@ -74,6 +74,9 @@ public:
virtual QString expression() const;
+ enum Type { PropertyBinding, ValueTypeProxy };
+ virtual Type bindingType() const { return PropertyBinding; }
+
void setEnabled(bool e) { setEnabled(e, QDeclarativePropertyPrivate::DontRemoveBinding); }
virtual void setEnabled(bool, QDeclarativePropertyPrivate::WriteFlags) = 0;
virtual int propertyIndex() = 0;
@@ -92,6 +95,7 @@ private:
friend class QDeclarativeProperty;
friend class QDeclarativePropertyPrivate;
friend class QDeclarativeVME;
+ friend class QDeclarativeValueTypeProxyBinding;
QObject *m_object;
QDeclarativeAbstractBinding **m_mePtr;
@@ -99,6 +103,30 @@ private:
QDeclarativeAbstractBinding *m_nextBinding;
};
+class QDeclarativeValueTypeProxyBinding : public QDeclarativeAbstractBinding
+{
+public:
+ QDeclarativeValueTypeProxyBinding(QObject *o, int coreIndex);
+ virtual ~QDeclarativeValueTypeProxyBinding();
+
+ virtual Type bindingType() const { return ValueTypeProxy; }
+
+ virtual void setEnabled(bool, QDeclarativePropertyPrivate::WriteFlags);
+ virtual int propertyIndex();
+ virtual void update(QDeclarativePropertyPrivate::WriteFlags);
+
+ QDeclarativeAbstractBinding *binding(int propertyIndex);
+
+private:
+ void recursiveEnable(QDeclarativeAbstractBinding *, QDeclarativePropertyPrivate::WriteFlags);
+ void recursiveDisable(QDeclarativeAbstractBinding *);
+
+ friend class QDeclarativeAbstractBinding;
+ QObject *m_object;
+ int m_index;
+ QDeclarativeAbstractBinding *m_bindings;
+};
+
class QDeclarativeContext;
class QDeclarativeBindingPrivate;
class Q_DECLARATIVE_EXPORT QDeclarativeBinding : public QDeclarativeExpression, public QDeclarativeAbstractBinding