aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2015-04-16 22:15:27 +0200
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2015-06-05 08:37:28 +0000
commit13ec9ab3b898a67403ce0031c4cfdc74d95d5560 (patch)
treefb1242373ebb385ccc306e02b941d9a64c3d6ff9
parentdb568f812464644b36418415a05399ccdf2022c2 (diff)
Move the target object into the base class
Change-Id: I912d7665b49c8e9b2d38e78bfcfc4b3d39ca7459 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
-rw-r--r--src/qml/qml/qqmlabstractbinding_p.h5
-rw-r--r--src/qml/qml/qqmlbinding.cpp5
-rw-r--r--src/qml/qml/qqmlbinding_p.h2
-rw-r--r--src/qml/qml/qqmlvaluetypeproxybinding.cpp12
-rw-r--r--src/qml/qml/qqmlvaluetypeproxybinding_p.h4
5 files changed, 10 insertions, 18 deletions
diff --git a/src/qml/qml/qqmlabstractbinding_p.h b/src/qml/qml/qqmlabstractbinding_p.h
index d4cb4e0e9e..aa76c9aeba 100644
--- a/src/qml/qml/qqmlabstractbinding_p.h
+++ b/src/qml/qml/qqmlabstractbinding_p.h
@@ -77,7 +77,7 @@ public:
// Should return the object for the binding. Should return this object even if the
// binding is not enabled or added to the object.
- virtual QObject *targetObject() const = 0;
+ QObject *targetObject() const { return m_target.data(); }
virtual void setEnabled(bool e, QQmlPropertyPrivate::WriteFlags f = QQmlPropertyPrivate::DontRemoveBinding) = 0;
@@ -121,6 +121,9 @@ private:
// This saves a compiler-generated pointer to a compiler-generated vTable, and thus reduces
// the binding object size by sizeof(void*).
qintptr m_nextBindingPtr;
+
+protected:
+ QFlagPointer<QObject> m_target;
};
QQmlAbstractBinding::Pointer
diff --git a/src/qml/qml/qqmlbinding.cpp b/src/qml/qml/qqmlbinding.cpp
index 24818cbcd1..ec9ac912b5 100644
--- a/src/qml/qml/qqmlbinding.cpp
+++ b/src/qml/qml/qqmlbinding.cpp
@@ -270,11 +270,6 @@ QString QQmlBinding::expression() const
return v->toQStringNoThrow();
}
-QObject *QQmlBinding::targetObject() const
-{
- return *m_target;
-}
-
int QQmlBinding::targetPropertyIndex() const
{
return m_index;
diff --git a/src/qml/qml/qqmlbinding_p.h b/src/qml/qml/qqmlbinding_p.h
index 2d09c0fae9..69d434ab25 100644
--- a/src/qml/qml/qqmlbinding_p.h
+++ b/src/qml/qml/qqmlbinding_p.h
@@ -84,7 +84,6 @@ public:
// Inherited from QQmlAbstractBinding
virtual void setEnabled(bool, QQmlPropertyPrivate::WriteFlags flags = QQmlPropertyPrivate::DontRemoveBinding);
virtual QString expression() const;
- virtual QObject *targetObject() const;
virtual int targetPropertyIndex() const;
void update(QQmlPropertyPrivate::WriteFlags flags = QQmlPropertyPrivate::DontRemoveBinding);
@@ -107,7 +106,6 @@ private:
inline void setEnabledFlag(bool);
QQmlPropertyData getPropertyData() const;
- QFlagPointer<QObject> m_target;
int m_index;
};
diff --git a/src/qml/qml/qqmlvaluetypeproxybinding.cpp b/src/qml/qml/qqmlvaluetypeproxybinding.cpp
index f0457d25e3..a12699facf 100644
--- a/src/qml/qml/qqmlvaluetypeproxybinding.cpp
+++ b/src/qml/qml/qqmlvaluetypeproxybinding.cpp
@@ -36,8 +36,11 @@
QT_BEGIN_NAMESPACE
QQmlValueTypeProxyBinding::QQmlValueTypeProxyBinding(QObject *o, int index)
-: QQmlAbstractBinding(ValueTypeProxy), m_object(o), m_index(index), m_bindings(0)
+ : QQmlAbstractBinding(ValueTypeProxy),
+ m_targetIndex(index),
+ m_bindings(0)
{
+ m_target = o;
}
QQmlValueTypeProxyBinding::~QQmlValueTypeProxyBinding()
@@ -103,12 +106,7 @@ void QQmlValueTypeProxyBinding::removeBindings(quint32 mask)
int QQmlValueTypeProxyBinding::targetPropertyIndex() const
{
- return m_index;
-}
-
-QObject *QQmlValueTypeProxyBinding::targetObject() const
-{
- return m_object;
+ return m_targetIndex;
}
QT_END_NAMESPACE
diff --git a/src/qml/qml/qqmlvaluetypeproxybinding_p.h b/src/qml/qml/qqmlvaluetypeproxybinding_p.h
index c73c944efd..6e618375d9 100644
--- a/src/qml/qml/qqmlvaluetypeproxybinding_p.h
+++ b/src/qml/qml/qqmlvaluetypeproxybinding_p.h
@@ -59,15 +59,13 @@ public:
virtual void setEnabled(bool, QQmlPropertyPrivate::WriteFlags);
virtual int targetPropertyIndex() const;
- virtual QObject *targetObject() const;
protected:
~QQmlValueTypeProxyBinding();
private:
friend class QQmlAbstractBinding;
- QObject *m_object;
- int m_index;
+ int m_targetIndex;
QQmlAbstractBinding *m_bindings;
};