summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qdeclarativebinding.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-03-15 05:58:35 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-03-17 00:20:49 (GMT)
commit26cd94ef47ffc969dc835e98b58eded14e669964 (patch)
tree9ec8e418ec0ce385bd07289d5368e221a5ce017e /src/declarative/qml/qdeclarativebinding.cpp
parent06766918436dc6c5de2e605e7ed3421c548c6782 (diff)
downloadQt-26cd94ef47ffc969dc835e98b58eded14e669964.zip
Qt-26cd94ef47ffc969dc835e98b58eded14e669964.tar.gz
Qt-26cd94ef47ffc969dc835e98b58eded14e669964.tar.bz2
Optimization: Reduce unnecessary QObject allocations
Diffstat (limited to 'src/declarative/qml/qdeclarativebinding.cpp')
-rw-r--r--src/declarative/qml/qdeclarativebinding.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/declarative/qml/qdeclarativebinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp
index bc78b5b..090bd5b 100644
--- a/src/declarative/qml/qdeclarativebinding.cpp
+++ b/src/declarative/qml/qdeclarativebinding.cpp
@@ -79,14 +79,25 @@ QDeclarativeBindingPrivate::QDeclarativeBindingPrivate()
{
}
-QDeclarativeBinding::QDeclarativeBinding(void *data, QDeclarativeRefCount *rc, QObject *obj, QDeclarativeContext *ctxt, const QString &url, int lineNumber, QObject *parent)
+QDeclarativeBinding::QDeclarativeBinding(void *data, QDeclarativeRefCount *rc, QObject *obj,
+ QDeclarativeContextData *ctxt, const QString &url, int lineNumber,
+ QObject *parent)
: QDeclarativeExpression(ctxt, data, rc, obj, url, lineNumber, *new QDeclarativeBindingPrivate)
{
setParent(parent);
setNotifyOnValueChanged(true);
}
-QDeclarativeBinding::QDeclarativeBinding(const QString &str, QObject *obj, QDeclarativeContext *ctxt, QObject *parent)
+QDeclarativeBinding::QDeclarativeBinding(const QString &str, QObject *obj, QDeclarativeContext *ctxt,
+ QObject *parent)
+: QDeclarativeExpression(QDeclarativeContextData::get(ctxt), str, obj, *new QDeclarativeBindingPrivate)
+{
+ setParent(parent);
+ setNotifyOnValueChanged(true);
+}
+
+QDeclarativeBinding::QDeclarativeBinding(const QString &str, QObject *obj, QDeclarativeContextData *ctxt,
+ QObject *parent)
: QDeclarativeExpression(ctxt, str, obj, *new QDeclarativeBindingPrivate)
{
setParent(parent);
@@ -181,8 +192,8 @@ void QDeclarativeBinding::update(QDeclarativePropertyPrivate::WriteFlags flags)
}
if (data->error.isValid()) {
- QDeclarativeEnginePrivate *p = (data->context() && data->context()->engine())?
- QDeclarativeEnginePrivate::get(data->context()->engine()):0;
+ QDeclarativeEnginePrivate *p = (data->context() && data->context()->engine)?
+ QDeclarativeEnginePrivate::get(data->context()->engine):0;
if (!data->addError(p))
qWarning().nospace() << qPrintable(this->error().toString());
} else {