summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBea Lam <bea.lam@nokia.com>2010-02-23 06:49:07 (GMT)
committerBea Lam <bea.lam@nokia.com>2010-02-23 06:49:07 (GMT)
commit55fff3383b7fbac972a96c62345bc898c99eafc0 (patch)
tree8a05c62566f4129babaa63fd62c9855a2a7585be
parentc2988e5bc92c81e35e6b11092a2c4fa237cf9fdb (diff)
parent287a8757e348f56e2ae918d1aa5bf329c985f620 (diff)
downloadQt-55fff3383b7fbac972a96c62345bc898c99eafc0.zip
Qt-55fff3383b7fbac972a96c62345bc898c99eafc0.tar.gz
Qt-55fff3383b7fbac972a96c62345bc898c99eafc0.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-qml
-rw-r--r--doc/src/declarative/elements.qdoc1
-rw-r--r--doc/src/declarative/extending.qdoc12
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp168
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsvisualitemmodel_p.h7
-rw-r--r--src/declarative/qml/qml.pri2
-rw-r--r--src/declarative/qml/qmlbinding.cpp12
-rw-r--r--src/declarative/qml/qmlbinding.h132
-rw-r--r--src/declarative/qml/qmlbinding_p.h76
-rw-r--r--src/declarative/qml/qmlbinding_p_p.h91
-rw-r--r--src/declarative/qml/qmlboundsignal.cpp3
-rw-r--r--src/declarative/qml/qmlcompiledbindings_p.h2
-rw-r--r--src/declarative/qml/qmlcompiler.cpp2
-rw-r--r--src/declarative/qml/qmlcomponent.cpp2
-rw-r--r--src/declarative/qml/qmlengine.cpp2
-rw-r--r--src/declarative/qml/qmlenginedebug.cpp7
-rw-r--r--src/declarative/qml/qmlexpression.cpp62
-rw-r--r--src/declarative/qml/qmlexpression.h11
-rw-r--r--src/declarative/qml/qmlexpression_p.h2
-rw-r--r--src/declarative/qml/qmlmetaproperty.cpp2
-rw-r--r--src/declarative/qml/qmlobjectscriptclass.cpp2
-rw-r--r--src/declarative/qml/qmlpropertycache.cpp4
-rw-r--r--src/declarative/qml/qmlvme.cpp4
-rw-r--r--src/declarative/qml/qmlwatcher.cpp1
-rw-r--r--src/declarative/util/qmlanimation.cpp1
-rw-r--r--src/declarative/util/qmlpropertychanges.cpp4
-rw-r--r--src/declarative/util/qmlstate.cpp2
-rw-r--r--src/declarative/util/qmlstategroup.cpp2
-rw-r--r--src/declarative/util/qmlstateoperations.cpp1
-rw-r--r--src/declarative/util/qmltransitionmanager.cpp2
-rw-r--r--tests/auto/declarative/qmldebug/tst_qmldebug.cpp2
-rw-r--r--tests/auto/declarative/qmlecmascript/testtypes.h10
-rw-r--r--tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp1
-rw-r--r--tests/auto/declarative/qmlgraphicspathview/tst_qmlgraphicspathview.cpp1
-rw-r--r--tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp2
34 files changed, 383 insertions, 252 deletions
diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc
index 682a2ac..b218b64 100644
--- a/doc/src/declarative/elements.qdoc
+++ b/doc/src/declarative/elements.qdoc
@@ -88,6 +88,7 @@ The following table lists the QML elements provided by the Qt Declarative module
\o \l Binding
\o \l ListModel, \l ListElement
\o \l VisualItemModel
+\o \l VisualDataModel
\o \l XmlListModel and XmlRole
\o \l DateTimeFormatter
\o \l NumberFormatter
diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc
index d3e6c14..396ddab 100644
--- a/doc/src/declarative/extending.qdoc
+++ b/doc/src/declarative/extending.qdoc
@@ -557,18 +557,6 @@ to be used in bindings should have a NOTIFY signal instead.
\l {Extending QML - Binding Example} shows the BirthdayParty example updated to
include NOTIFY signals for use in binding.
-\section1 Binding and Script Properties
-
-While generally no changes are needed to a C++ class to use property
-binding, sometimes more advanced interaction between the binding engine and
-an object is desirable. To facilitate this, there is a special exception
-in the bind engine for allowing an object to access the binding directly.
-
-If a binding is assigned to a property with a type of QmlBinding
-pointer (ie. \c {QmlBinding *}), each time the binding value changes,
-a QmlBinding instance is assigned to that property. The QmlBinding instance
-allows the object to read the binding and to evaluate the binding's current value.
-
\section1 Extension Objects
\snippet examples/declarative/extending/extended/example.qml 0
diff --git a/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp b/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp
index 9216793..9c11f25 100644
--- a/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp
@@ -187,7 +187,6 @@ QVariant QmlGraphicsVisualItemModel::evaluate(int index, const QString &expressi
QmlContext *ctxt = new QmlContext(ccontext);
ctxt->addDefaultObject(d->children.at(index));
QmlExpression e(ctxt, expression, objectContext);
- e.setTrackChange(false);
QVariant value = e.value();
delete ctxt;
return value;
@@ -327,7 +326,7 @@ public:
if (m_listModelInterface)
return m_listModelInterface->count();
if (m_abstractItemModel)
- return m_abstractItemModel->rowCount();
+ return m_abstractItemModel->rowCount(m_root);
if (m_listAccessor)
return m_listAccessor->count();
return 0;
@@ -348,6 +347,8 @@ public:
QVariant m_modelVariant;
QmlListAccessor *m_listAccessor;
+
+ QModelIndex m_root;
};
class QmlGraphicsVisualDataModelDataMetaObject : public QmlOpenMetaObject
@@ -461,7 +462,7 @@ QVariant QmlGraphicsVisualDataModelDataMetaObject::initialValue(int propId)
QHash<QByteArray,int>::const_iterator it = model->m_roleNames.find(propName);
if (it != model->m_roleNames.end()) {
roleToProp.insert(*it, propId);
- QModelIndex index = model->m_abstractItemModel->index(data->m_index, 0);
+ QModelIndex index = model->m_abstractItemModel->index(data->m_index, 0, model->m_root);
return model->m_abstractItemModel->data(index, *it);
}
}
@@ -560,6 +561,39 @@ QmlGraphicsVisualDataModelData *QmlGraphicsVisualDataModelPrivate::data(QObject
//---------------------------------------------------------------------------
+/*!
+ \qmlclass VisualDataModel QmlGraphicsVisualDataModel
+ \brief The VisualDataModel encapsulates a model and delegate
+
+ A VisualDataModel encapsulates a model and the delegate that will
+ be instantiated for items in the model.
+
+ It is usually not necessary to create a VisualDataModel directly,
+ since the QML views will create one internally.
+
+ The example below illustrates using a VisualDataModel with a ListView.
+
+ \code
+ VisualDataModel {
+ id: visualModel
+ model: myModel
+ delegate: Component {
+ Rectangle {
+ height: 25
+ width: 100
+ Text { text: "Name:" + name}
+ }
+ }
+ }
+ ListView {
+ width: 100
+ height: 100
+ anchors.fill: parent
+ model: visualModel
+ }
+ \endcode
+*/
+
QmlGraphicsVisualDataModel::QmlGraphicsVisualDataModel()
: QmlGraphicsVisualModel(*(new QmlGraphicsVisualDataModelPrivate(0)))
{
@@ -579,6 +613,20 @@ QmlGraphicsVisualDataModel::~QmlGraphicsVisualDataModel()
d->m_delegateDataType->release();
}
+/*!
+ \qmlproperty model VisualDataModel::model
+ This property holds the model providing data for the VisualDataModel.
+
+ The model provides a set of data that is used to create the items
+ for a view. For large or dynamic datasets the model is usually
+ provided by a C++ model object. The C++ model object must be a \l
+ {QAbstractItemModel} subclass or a simple list.
+
+ Models can also be created directly in QML, using a \l{ListModel} or
+ \l{XmlListModel}.
+
+ \sa {qmlmodels}{Data Models}
+*/
QVariant QmlGraphicsVisualDataModel::model() const
{
Q_D(const QmlGraphicsVisualDataModel);
@@ -682,6 +730,16 @@ void QmlGraphicsVisualDataModel::setModel(const QVariant &model)
}
}
+/*!
+ \qmlproperty component VisualDataModel::delegate
+
+ The delegate provides a template defining each item instantiated by a view.
+ The index is exposed as an accessible \c index property. Properties of the
+ model are also available depending upon the type of \l {qmlmodels}{Data Model}.
+
+ Here is an example delegate:
+ \snippet doc/src/snippets/declarative/listview/listview.qml 0
+*/
QmlComponent *QmlGraphicsVisualDataModel::delegate() const
{
Q_D(const QmlGraphicsVisualDataModel);
@@ -705,6 +763,105 @@ void QmlGraphicsVisualDataModel::setDelegate(QmlComponent *delegate)
}
}
+/*!
+ \qmlproperty QModelIndex VisualDataModel::rootIndex
+
+ QAbstractItemModel provides a heirachical tree of data, whereas
+ QML only operates on list data. rootIndex allows the children of
+ any node in a QAbstractItemModel to be provided by this model.
+
+ This property only affects models of type QAbstractItemModel.
+
+ \code
+ // main.cpp
+ Q_DECLARE_METATYPE(QModelIndex)
+
+ class MyModel : public QDirModel
+ {
+ Q_OBJECT
+ public:
+ MyModel(QmlContext *ctxt) : QDirModel(), context(ctxt) {
+ QHash<int,QByteArray> roles = roleNames();
+ roles.insert(FilePathRole, "path");
+ setRoleNames(roles);
+ context->setContextProperty("myModel", this);
+ context->setContextProperty("myRoot", QVariant::fromValue(index(0,0,QModelIndex())));
+ }
+
+ Q_INVOKABLE void setRoot(const QString &path) {
+ QModelIndex root = index(path);
+ context->setContextProperty("myRoot", QVariant::fromValue(root));
+ }
+
+ QmlContext *context;
+ };
+
+ int main(int argc, char ** argv)
+ {
+ QApplication app(argc, argv);
+
+ QmlView view;
+ view.setSource(QUrl("qrc:view.qml"));
+
+ MyModel model(view.rootContext());
+
+ view.execute();
+ view.show();
+
+ return app.exec();
+ }
+
+ #include "main.moc"
+ \endcode
+
+ \code
+ // view.qml
+ import Qt 4.6
+
+ ListView {
+ width: 200
+ height: 200
+ model: VisualDataModel {
+ model: myModel
+ rootIndex: myRoot
+ delegate: Component {
+ Rectangle {
+ height: 25; width: 100
+ Text { text: path }
+ MouseRegion {
+ anchors.fill: parent;
+ onClicked: myModel.setRoot(path)
+ }
+ }
+ }
+ }
+ }
+ \endcode
+
+*/
+QModelIndex QmlGraphicsVisualDataModel::rootIndex() const
+{
+ Q_D(const QmlGraphicsVisualDataModel);
+ return d->m_root;
+}
+
+void QmlGraphicsVisualDataModel::setRootIndex(const QModelIndex &root)
+{
+ Q_D(QmlGraphicsVisualDataModel);
+ if (d->m_root != root) {
+ int oldCount = d->modelCount();
+ d->m_root = root;
+ int newCount = d->modelCount();
+ if (d->m_delegate && oldCount)
+ emit itemsRemoved(0, oldCount);
+ if (d->m_delegate && newCount)
+ emit itemsInserted(0, newCount);
+ if (newCount != oldCount)
+ emit countChanged();
+ emit rootIndexChanged();
+ }
+}
+
QString QmlGraphicsVisualDataModel::part() const
{
Q_D(const QmlGraphicsVisualDataModel);
@@ -786,7 +943,6 @@ QmlGraphicsItem *QmlGraphicsVisualDataModel::item(int index, const QByteArray &v
if (d->modelCount() <= 0 || !d->m_delegate)
return 0;
-
QObject *nobj = d->m_cache.getItem(index);
if (!nobj) {
QmlContext *ccontext = d->m_context;
@@ -900,7 +1056,6 @@ QVariant QmlGraphicsVisualDataModel::evaluate(int index, const QString &expressi
QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem *>(nobj);
if (item) {
QmlExpression e(qmlContext(item), expression, objectContext);
- e.setTrackChange(false);
value = e.value();
}
} else {
@@ -910,7 +1065,6 @@ QVariant QmlGraphicsVisualDataModel::evaluate(int index, const QString &expressi
QmlGraphicsVisualDataModelData *data = new QmlGraphicsVisualDataModelData(index, this);
ctxt->addDefaultObject(data);
QmlExpression e(ctxt, expression, objectContext);
- e.setTrackChange(false);
value = e.value();
delete data;
delete ctxt;
@@ -943,7 +1097,7 @@ void QmlGraphicsVisualDataModel::_q_itemsChanged(int index, int count,
if (d->m_listModelInterface) {
data->setValue(propId, d->m_listModelInterface->data(ii, QList<int>() << role).value(role));
} else if (d->m_abstractItemModel) {
- QModelIndex index = d->m_abstractItemModel->index(ii, 0);
+ QModelIndex index = d->m_abstractItemModel->index(ii, 0, d->m_root);
data->setValue(propId, d->m_abstractItemModel->data(index, role));
}
}
diff --git a/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel_p.h b/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel_p.h
index 49f9b27..7dc41a8 100644
--- a/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel_p.h
@@ -49,6 +49,8 @@
QT_BEGIN_HEADER
+Q_DECLARE_METATYPE(QModelIndex)
+
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
@@ -147,6 +149,7 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsVisualDataModel : public QmlGraphicsVisual
Q_PROPERTY(QmlComponent *delegate READ delegate WRITE setDelegate)
Q_PROPERTY(QString part READ part WRITE setPart)
Q_PROPERTY(QObject *parts READ parts CONSTANT)
+ Q_PROPERTY(QModelIndex rootIndex READ rootIndex WRITE setRootIndex NOTIFY rootIndexChanged)
Q_CLASSINFO("DefaultProperty", "delegate")
public:
QmlGraphicsVisualDataModel();
@@ -159,6 +162,9 @@ public:
QmlComponent *delegate() const;
void setDelegate(QmlComponent *);
+ QModelIndex rootIndex() const;
+ void setRootIndex(const QModelIndex &root);
+
QString part() const;
void setPart(const QString &);
@@ -178,6 +184,7 @@ public:
Q_SIGNALS:
void createdPackage(int index, QmlPackage *package);
void destroyingPackage(QmlPackage *package);
+ void rootIndexChanged();
private Q_SLOTS:
void _q_itemsChanged(int, int, const QList<int> &);
diff --git a/src/declarative/qml/qml.pri b/src/declarative/qml/qml.pri
index 2313c37..f09a944 100644
--- a/src/declarative/qml/qml.pri
+++ b/src/declarative/qml/qml.pri
@@ -60,8 +60,8 @@ HEADERS += \
$$PWD/qmlinstruction_p.h \
$$PWD/qmlvmemetaobject_p.h \
$$PWD/qml.h \
- $$PWD/qmlbinding.h \
$$PWD/qmlbinding_p.h \
+ $$PWD/qmlbinding_p_p.h \
$$PWD/qmlmetaproperty.h \
$$PWD/qmlmoduleplugin.h \
$$PWD/qmlcomponent.h \
diff --git a/src/declarative/qml/qmlbinding.cpp b/src/declarative/qml/qmlbinding.cpp
index feadd0f..aeda28b 100644
--- a/src/declarative/qml/qmlbinding.cpp
+++ b/src/declarative/qml/qmlbinding.cpp
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#include "qmlbinding.h"
#include "qmlbinding_p.h"
+#include "qmlbinding_p_p.h"
#include "qml.h"
#include "qmlcontext.h"
@@ -85,12 +85,14 @@ QmlBinding::QmlBinding(void *data, QmlRefCount *rc, QObject *obj, QmlContext *ct
: QmlExpression(ctxt, data, rc, obj, url, lineNumber, *new QmlBindingPrivate)
{
setParent(parent);
+ setNotifyOnValueChanged(true);
}
QmlBinding::QmlBinding(const QString &str, QObject *obj, QmlContext *ctxt, QObject *parent)
: QmlExpression(ctxt, str, obj, *new QmlBindingPrivate)
{
setParent(parent);
+ setNotifyOnValueChanged(true);
}
QmlBinding::~QmlBinding()
@@ -198,17 +200,17 @@ void QmlBinding::update(QmlMetaProperty::WriteFlags flags)
data->release();
}
-void QmlBinding::emitValueChanged()
+void QmlBindingPrivate::emitValueChanged()
{
- update();
- // don't bother calling valueChanged()
+ Q_Q(QmlBinding);
+ q->update();
}
void QmlBinding::setEnabled(bool e, QmlMetaProperty::WriteFlags flags)
{
Q_D(QmlBinding);
d->bindingData()->enabled = e;
- setTrackChange(e);
+ setNotifyOnValueChanged(e);
QmlAbstractBinding::setEnabled(e, flags);
diff --git a/src/declarative/qml/qmlbinding.h b/src/declarative/qml/qmlbinding.h
deleted file mode 100644
index 151b71c..0000000
--- a/src/declarative/qml/qmlbinding.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMLBINDING_H
-#define QMLBINDING_H
-
-#include "qml.h"
-#include "qmlpropertyvaluesource.h"
-#include "qmlexpression.h"
-
-#include <QtCore/QObject>
-#include <QtCore/QMetaProperty>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
-
-class Q_DECLARATIVE_EXPORT QmlAbstractBinding
-{
-public:
- QmlAbstractBinding();
- virtual ~QmlAbstractBinding();
-
- virtual void destroy();
-
- virtual QString expression() const;
-
- void setEnabled(bool e) { setEnabled(e, QmlMetaProperty::DontRemoveBinding); }
- virtual void setEnabled(bool, QmlMetaProperty::WriteFlags) = 0;
- virtual int propertyIndex() = 0;
-
- void update() { update(QmlMetaProperty::DontRemoveBinding); }
- virtual void update(QmlMetaProperty::WriteFlags) = 0;
-
- void addToObject(QObject *);
- void removeFromObject();
-
-protected:
- void clear();
-
-private:
- friend class QmlDeclarativeData;
- friend class QmlMetaProperty;
- friend class QmlMetaPropertyPrivate;
- friend class QmlVME;
-
- QObject *m_object;
- QmlAbstractBinding **m_mePtr;
- QmlAbstractBinding **m_prevBinding;
- QmlAbstractBinding *m_nextBinding;
-};
-
-class QmlContext;
-class QmlBindingPrivate;
-class Q_DECLARATIVE_EXPORT QmlBinding : public QmlExpression,
- public QmlAbstractBinding
-{
-Q_OBJECT
-public:
- QmlBinding(const QString &, QObject *, QmlContext *, QObject *parent=0);
- QmlBinding(void *, QmlRefCount *, QObject *, QmlContext *, const QString &, int,
- QObject *parent);
- ~QmlBinding();
-
- void setTarget(const QmlMetaProperty &);
- QmlMetaProperty property() const;
-
- bool enabled() const;
-
- // Inherited from QmlAbstractBinding
- virtual void setEnabled(bool, QmlMetaProperty::WriteFlags flags);
- virtual int propertyIndex();
- virtual void update(QmlMetaProperty::WriteFlags flags);
- virtual QString expression() const;
-
-public Q_SLOTS:
- void update() { update(QmlMetaProperty::DontRemoveBinding); }
-
-protected:
- void emitValueChanged();
-
-private:
- Q_DECLARE_PRIVATE(QmlBinding)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QmlBinding);
-
-QT_END_HEADER
-
-#endif // QMLBINDING_H
diff --git a/src/declarative/qml/qmlbinding_p.h b/src/declarative/qml/qmlbinding_p.h
index b4f88b5..4594476 100644
--- a/src/declarative/qml/qmlbinding_p.h
+++ b/src/declarative/qml/qmlbinding_p.h
@@ -53,36 +53,82 @@
// We mean it.
//
-#include "qmlbinding.h"
+#include "qml.h"
+#include "qmlpropertyvaluesource.h"
+#include "qmlexpression.h"
-#include "qmlmetaproperty.h"
-#include "qmlexpression_p.h"
+#include <QtCore/QObject>
+#include <QtCore/QMetaProperty>
QT_BEGIN_NAMESPACE
-class QmlBindingData : public QmlExpressionData
+class Q_AUTOTEST_EXPORT QmlAbstractBinding
{
public:
- QmlBindingData();
- virtual ~QmlBindingData();
+ QmlAbstractBinding();
+ virtual ~QmlAbstractBinding();
- bool updating:1;
- bool enabled:1;
+ virtual void destroy();
- QmlMetaProperty property;
+ virtual QString expression() const;
- virtual void refresh();
+ void setEnabled(bool e) { setEnabled(e, QmlMetaProperty::DontRemoveBinding); }
+ virtual void setEnabled(bool, QmlMetaProperty::WriteFlags) = 0;
+ virtual int propertyIndex() = 0;
+
+ void update() { update(QmlMetaProperty::DontRemoveBinding); }
+ virtual void update(QmlMetaProperty::WriteFlags) = 0;
+
+ void addToObject(QObject *);
+ void removeFromObject();
+
+protected:
+ void clear();
+
+private:
+ friend class QmlDeclarativeData;
+ friend class QmlMetaProperty;
+ friend class QmlMetaPropertyPrivate;
+ friend class QmlVME;
+
+ QObject *m_object;
+ QmlAbstractBinding **m_mePtr;
+ QmlAbstractBinding **m_prevBinding;
+ QmlAbstractBinding *m_nextBinding;
};
-class QmlBindingPrivate : public QmlExpressionPrivate
+class QmlContext;
+class QmlBindingPrivate;
+class Q_AUTOTEST_EXPORT QmlBinding : public QmlExpression, public QmlAbstractBinding
{
- Q_DECLARE_PUBLIC(QmlBinding)
+Q_OBJECT
public:
- QmlBindingPrivate();
+ QmlBinding(const QString &, QObject *, QmlContext *, QObject *parent=0);
+ QmlBinding(void *, QmlRefCount *, QObject *, QmlContext *, const QString &, int,
+ QObject *parent);
+ ~QmlBinding();
+
+ void setTarget(const QmlMetaProperty &);
+ QmlMetaProperty property() const;
+
+ bool enabled() const;
+
+ // Inherited from QmlAbstractBinding
+ virtual void setEnabled(bool, QmlMetaProperty::WriteFlags flags);
+ virtual int propertyIndex();
+ virtual void update(QmlMetaProperty::WriteFlags flags);
+ virtual QString expression() const;
+
+public Q_SLOTS:
+ void update() { update(QmlMetaProperty::DontRemoveBinding); }
+
+protected:
+ void emitValueChanged();
- QmlBindingData *bindingData() { return static_cast<QmlBindingData *>(data); }
- const QmlBindingData *bindingData() const { return static_cast<const QmlBindingData *>(data); }
+private:
+ Q_DECLARE_PRIVATE(QmlBinding)
};
+Q_DECLARE_METATYPE(QmlBinding*);
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qmlbinding_p_p.h b/src/declarative/qml/qmlbinding_p_p.h
new file mode 100644
index 0000000..131bacc
--- /dev/null
+++ b/src/declarative/qml/qmlbinding_p_p.h
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QMLBINDING_P_P_H
+#define QMLBINDING_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qmlbinding_p.h"
+
+#include "qmlmetaproperty.h"
+#include "qmlexpression_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QmlBindingData : public QmlExpressionData
+{
+public:
+ QmlBindingData();
+ virtual ~QmlBindingData();
+
+ bool updating:1;
+ bool enabled:1;
+
+ QmlMetaProperty property;
+
+ virtual void refresh();
+};
+
+class QmlBindingPrivate : public QmlExpressionPrivate
+{
+ Q_DECLARE_PUBLIC(QmlBinding)
+public:
+ QmlBindingPrivate();
+
+ QmlBindingData *bindingData() { return static_cast<QmlBindingData *>(data); }
+ const QmlBindingData *bindingData() const { return static_cast<const QmlBindingData *>(data); }
+
+ virtual void emitValueChanged();
+};
+
+QT_END_NAMESPACE
+
+#endif // QMLBINDING_P_P_H
diff --git a/src/declarative/qml/qmlboundsignal.cpp b/src/declarative/qml/qmlboundsignal.cpp
index a075899..db5fd61 100644
--- a/src/declarative/qml/qmlboundsignal.cpp
+++ b/src/declarative/qml/qmlboundsignal.cpp
@@ -124,7 +124,6 @@ QmlBoundSignal::QmlBoundSignal(QmlContext *ctxt, const QString &val,
QMetaObject::connect(scope, m_signal.methodIndex(), this, evaluateIdx);
m_expression = new QmlExpression(ctxt, val, scope);
- m_expression->setTrackChange(false);
}
QmlBoundSignal::~QmlBoundSignal()
@@ -157,7 +156,7 @@ QmlExpression *QmlBoundSignal::setExpression(QmlExpression *e)
{
QmlExpression *rv = m_expression;
m_expression = e;
- if (m_expression) m_expression->setTrackChange(false);
+ if (m_expression) m_expression->setNotifyOnValueChanged(false);
return rv;
}
diff --git a/src/declarative/qml/qmlcompiledbindings_p.h b/src/declarative/qml/qmlcompiledbindings_p.h
index 38fb2a3..056cc21 100644
--- a/src/declarative/qml/qmlcompiledbindings_p.h
+++ b/src/declarative/qml/qmlcompiledbindings_p.h
@@ -54,7 +54,7 @@
//
#include "qmlexpression_p.h"
-#include "qmlbinding.h"
+#include "qmlbinding_p.h"
QT_BEGIN_HEADER
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp
index bbae201..10b6e4f 100644
--- a/src/declarative/qml/qmlcompiler.cpp
+++ b/src/declarative/qml/qmlcompiler.cpp
@@ -63,7 +63,7 @@
#include "qmlscriptstring.h"
#include "qmlglobal_p.h"
#include "qmlscriptparser_p.h"
-#include "qmlbinding.h"
+#include "qmlbinding_p.h"
#include "qmlcompiledbindings_p.h"
#include <qfxperf_p_p.h>
diff --git a/src/declarative/qml/qmlcomponent.cpp b/src/declarative/qml/qmlcomponent.cpp
index 87ecb8a..4ab4f70 100644
--- a/src/declarative/qml/qmlcomponent.cpp
+++ b/src/declarative/qml/qmlcomponent.cpp
@@ -49,8 +49,8 @@
#include "qmlvme_p.h"
#include "qml.h"
#include "qmlengine.h"
-#include "qmlbinding.h"
#include "qmlbinding_p.h"
+#include "qmlbinding_p_p.h"
#include "qmlglobal_p.h"
#include "qmlscriptparser_p.h"
diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp
index 97d8250..2460f52 100644
--- a/src/declarative/qml/qmlengine.cpp
+++ b/src/declarative/qml/qmlengine.cpp
@@ -51,7 +51,7 @@
#include "qmlcomponent.h"
#include "qmlmetaproperty_p.h"
#include "qmlmoduleplugin.h"
-#include "qmlbinding_p.h"
+#include "qmlbinding_p_p.h"
#include "qmlvme_p.h"
#include "qmlenginedebug_p.h"
#include "qmlstringconverters_p.h"
diff --git a/src/declarative/qml/qmlenginedebug.cpp b/src/declarative/qml/qmlenginedebug.cpp
index 654157c..973e5e5 100644
--- a/src/declarative/qml/qmlenginedebug.cpp
+++ b/src/declarative/qml/qmlenginedebug.cpp
@@ -45,7 +45,7 @@
#include "qmlengine.h"
#include "qmlmetatype.h"
#include "qmlmetaproperty.h"
-#include "qmlbinding.h"
+#include "qmlbinding_p.h"
#include "qmlcontext_p.h"
#include "qmlwatcher_p.h"
@@ -408,14 +408,13 @@ void QmlEngineDebugServer::messageReceived(const QByteArray &message)
QmlContext *context = qmlContext(object);
QVariant result;
if (object && context) {
- QmlExpression *exprObj = new QmlExpression(context, expr, object);
+ QmlExpression exprObj(context, expr, object);
bool undefined = false;
- QVariant value = exprObj->value(&undefined);
+ QVariant value = exprObj.value(&undefined);
if (undefined)
result = QLatin1String("<undefined>");
else
result = valueContents(value);
- delete exprObj;
} else {
result = QLatin1String("<unknown context>");
}
diff --git a/src/declarative/qml/qmlexpression.cpp b/src/declarative/qml/qmlexpression.cpp
index 8f0c945..64b2d7f 100644
--- a/src/declarative/qml/qmlexpression.cpp
+++ b/src/declarative/qml/qmlexpression.cpp
@@ -70,7 +70,7 @@ bool QmlDelayedError::addError(QmlEnginePrivate *e)
QmlExpressionData::QmlExpressionData()
: q(0), dataRef(0), expressionFunctionValid(false), expressionRewritten(false), me(0),
- trackChange(true), isShared(false), line(-1), guardList(0), guardListLength(0)
+ trackChange(false), isShared(false), line(-1), guardList(0), guardListLength(0)
{
}
@@ -273,14 +273,6 @@ QString QmlExpression::expression() const
}
/*!
- Clear the expression.
-*/
-void QmlExpression::clearExpression()
-{
- setExpression(QString());
-}
-
-/*!
Set the expression to \a expression.
*/
void QmlExpression::setExpression(const QString &expression)
@@ -495,44 +487,34 @@ QVariant QmlExpression::value(bool *isUndefined)
}
/*!
- Returns true if the expression results in a constant value.
- QmlExpression::value() must have been invoked at least once before the
- return from this method is valid.
- */
-bool QmlExpression::isConstant() const
-{
- Q_D(const QmlExpression);
- return !d->data->guardList;
-}
-
-/*!
- Returns true if the changes are tracked in the expression's value.
+Returns true if the valueChanged() signal is emitted when the expression's evaluated
+value changes.
*/
-bool QmlExpression::trackChange() const
+bool QmlExpression::notifyOnValueChanged() const
{
Q_D(const QmlExpression);
return d->data->trackChange;
}
/*!
- Set whether changes are tracked in the expression's value to \a trackChange.
+Sets whether the valueChanged() signal is emitted when the expression's evaluated
+value changes.
- If true, the QmlExpression will monitor properties involved in the
- expression's evaluation, and call QmlExpression::valueChanged() if they have
- changed. This allows an application to ensure that any value associated
- with the result of the expression remains up to date.
+If true, the QmlExpression will monitor properties involved in the expression's
+evaluation, and emit QmlExpression::valueChanged() if they have changed. This allows
+an application to ensure that any value associated with the result of the expression
+remains up to date.
- If false, the QmlExpression will not montitor properties involved in the
- expression's evaluation, and QmlExpression::valueChanged() will never be
- called. This is more efficient if an application wants a "one off"
- evaluation of the expression.
+If false, the QmlExpression will not montitor properties involved in the expression's
+evaluation, and QmlExpression::valueChanged() will never be emitted. This is more efficient
+if an application wants a "one off" evaluation of the expression.
- By default, trackChange is true.
+By default, notifyOnChange is false.
*/
-void QmlExpression::setTrackChange(bool trackChange)
+void QmlExpression::setNotifyOnValueChanged(bool notifyOnChange)
{
Q_D(QmlExpression);
- d->data->trackChange = trackChange;
+ d->data->trackChange = notifyOnChange;
}
/*!
@@ -618,7 +600,8 @@ QmlError QmlExpression::error() const
/*! \internal */
void QmlExpression::__q_notify()
{
- emitValueChanged();
+ Q_D(QmlExpression);
+ d->emitValueChanged();
}
void QmlExpressionPrivate::clearGuards()
@@ -765,13 +748,10 @@ void QmlExpressionPrivate::updateGuards(const QPODVector<QmlEnginePrivate::Captu
calling QmlExpression::value()) before this signal will be emitted.
*/
-/*!
- Subclasses can capture the emission of the valueChanged() signal by overriding
- this function. They can choose whether to then call valueChanged().
-*/
-void QmlExpression::emitValueChanged()
+void QmlExpressionPrivate::emitValueChanged()
{
- emit valueChanged();
+ Q_Q(QmlExpression);
+ emit q->valueChanged();
}
QmlAbstractExpression::QmlAbstractExpression()
diff --git a/src/declarative/qml/qmlexpression.h b/src/declarative/qml/qmlexpression.h
index 428eefa..61374f2 100644
--- a/src/declarative/qml/qmlexpression.h
+++ b/src/declarative/qml/qmlexpression.h
@@ -70,12 +70,10 @@ public:
QmlContext *context() const;
QString expression() const;
- void clearExpression();
- virtual void setExpression(const QString &);
- bool isConstant() const;
+ void setExpression(const QString &);
- bool trackChange() const;
- void setTrackChange(bool);
+ bool notifyOnValueChanged() const;
+ void setNotifyOnValueChanged(bool);
QString sourceFile() const;
int lineNumber() const;
@@ -87,15 +85,12 @@ public:
void clearError();
QmlError error() const;
-public Q_SLOTS:
QVariant value(bool *isUndefined = 0);
Q_SIGNALS:
void valueChanged();
protected:
- virtual void emitValueChanged();
-
QmlExpression(QmlContext *, const QString &, QObject *,
QmlExpressionPrivate &dd);
QmlExpression(QmlContext *, void *, QmlRefCount *rc, QObject *me, const QString &,
diff --git a/src/declarative/qml/qmlexpression_p.h b/src/declarative/qml/qmlexpression_p.h
index e52a199..e4bed05 100644
--- a/src/declarative/qml/qmlexpression_p.h
+++ b/src/declarative/qml/qmlexpression_p.h
@@ -177,6 +177,8 @@ public:
return expr->q_func();
}
+ virtual void emitValueChanged();
+
static void exceptionToError(QScriptEngine *, QmlError &);
static QScriptValue evalInObjectScope(QmlContext *, QObject *, const QString &);
static QScriptValue evalInObjectScope(QmlContext *, QObject *, const QScriptProgram &);
diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp
index 1742c43..ac619ec 100644
--- a/src/declarative/qml/qmlmetaproperty.cpp
+++ b/src/declarative/qml/qmlmetaproperty.cpp
@@ -44,7 +44,7 @@
#include "qmlcompositetypedata_p.h"
#include "qml.h"
-#include "qmlbinding.h"
+#include "qmlbinding_p.h"
#include "qmlcontext.h"
#include "qmlcontext_p.h"
#include "qmlboundsignal_p.h"
diff --git a/src/declarative/qml/qmlobjectscriptclass.cpp b/src/declarative/qml/qmlobjectscriptclass.cpp
index 15ece1d..155a7d6 100644
--- a/src/declarative/qml/qmlobjectscriptclass.cpp
+++ b/src/declarative/qml/qmlobjectscriptclass.cpp
@@ -46,7 +46,7 @@
#include "qmldeclarativedata_p.h"
#include "qmltypenamescriptclass_p.h"
#include "qmllistscriptclass_p.h"
-#include "qmlbinding.h"
+#include "qmlbinding_p.h"
#include "qmlguard_p.h"
#include "qmlvmemetaobject_p.h"
diff --git a/src/declarative/qml/qmlpropertycache.cpp b/src/declarative/qml/qmlpropertycache.cpp
index a3e655b..2d087b6 100644
--- a/src/declarative/qml/qmlpropertycache.cpp
+++ b/src/declarative/qml/qmlpropertycache.cpp
@@ -42,8 +42,8 @@
#include "qmlpropertycache_p.h"
#include "qmlengine_p.h"
-#include "qmlbinding.h"
-#include "qdebug.h"
+#include "qmlbinding_p.h"
+#include <QtCore/qdebug.h>
Q_DECLARE_METATYPE(QScriptValue);
diff --git a/src/declarative/qml/qmlvme.cpp b/src/declarative/qml/qmlvme.cpp
index 8655809..f8f1ff0 100644
--- a/src/declarative/qml/qmlvme.cpp
+++ b/src/declarative/qml/qmlvme.cpp
@@ -51,11 +51,11 @@
#include "qmlengine.h"
#include "qmlcontext.h"
#include "qmlcomponent.h"
-#include "qmlbinding.h"
+#include "qmlbinding_p.h"
#include "qmlengine_p.h"
#include "qmlcomponent_p.h"
#include "qmlvmemetaobject_p.h"
-#include "qmlbinding_p.h"
+#include "qmlbinding_p_p.h"
#include "qmlcontext_p.h"
#include "qmlcompiledbindings_p.h"
#include "qmlglobal_p.h"
diff --git a/src/declarative/qml/qmlwatcher.cpp b/src/declarative/qml/qmlwatcher.cpp
index 59503de..a8a94c5 100644
--- a/src/declarative/qml/qmlwatcher.cpp
+++ b/src/declarative/qml/qmlwatcher.cpp
@@ -154,6 +154,7 @@ bool QmlWatcher::addWatch(int id, quint32 objectId, const QString &expr)
QmlContext *context = qmlContext(object);
if (context) {
QmlExpression *exprObj = new QmlExpression(context, expr, object);
+ exprObj->setNotifyOnValueChanged(true);
QmlWatchProxy *proxy = new QmlWatchProxy(id, exprObj, objectId, this);
exprObj->setParent(proxy);
m_proxies[id].append(proxy);
diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp
index c044f97..6dcce58 100644
--- a/src/declarative/util/qmlanimation.cpp
+++ b/src/declarative/util/qmlanimation.cpp
@@ -793,7 +793,6 @@ void QmlScriptActionPrivate::execute()
const QString &str = scriptStr.script();
if (!str.isEmpty()) {
QmlExpression expr(scriptStr.context(), str, scriptStr.scopeObject());
- expr.setTrackChange(false);
expr.value();
}
}
diff --git a/src/declarative/util/qmlpropertychanges.cpp b/src/declarative/util/qmlpropertychanges.cpp
index 068cb4d..3abbadd 100644
--- a/src/declarative/util/qmlpropertychanges.cpp
+++ b/src/declarative/util/qmlpropertychanges.cpp
@@ -47,7 +47,7 @@
#include <qmlcustomparser_p.h>
#include <qmlparser_p.h>
#include <qmlexpression.h>
-#include <qmlbinding.h>
+#include <qmlbinding_p.h>
#include <qmlcontext.h>
#include <qmlguard_p.h>
@@ -277,14 +277,12 @@ void QmlPropertyChangesPrivate::decode()
QmlMetaProperty prop = property(name); //### better way to check for signal property?
if (prop.type() & QmlMetaProperty::SignalProperty) {
QmlExpression *expression = new QmlExpression(qmlContext(q), data.toString(), object);
- expression->setTrackChange(false);
QmlReplaceSignalHandler *handler = new QmlReplaceSignalHandler;
handler->property = prop;
handler->expression = expression;
signalReplacements << handler;
} else if (isScript) {
QmlExpression *expression = new QmlExpression(qmlContext(q), data.toString(), object);
- expression->setTrackChange(false);
expressions << qMakePair(name, expression);
} else {
properties << qMakePair(name, data);
diff --git a/src/declarative/util/qmlstate.cpp b/src/declarative/util/qmlstate.cpp
index 4462b1f..ea99bd5 100644
--- a/src/declarative/util/qmlstate.cpp
+++ b/src/declarative/util/qmlstate.cpp
@@ -48,7 +48,7 @@
#include "qmlanimation_p.h"
#include "qmlanimation_p_p.h"
-#include <qmlbinding.h>
+#include <qmlbinding_p.h>
#include <qmlglobal_p.h>
#include <QtCore/qdebug.h>
diff --git a/src/declarative/util/qmlstategroup.cpp b/src/declarative/util/qmlstategroup.cpp
index 4ad77c8..7a5db1b 100644
--- a/src/declarative/util/qmlstategroup.cpp
+++ b/src/declarative/util/qmlstategroup.cpp
@@ -44,7 +44,7 @@
#include "qmltransition_p.h"
#include "qmlstate_p_p.h"
-#include <qmlbinding.h>
+#include <qmlbinding_p.h>
#include <qmlglobal_p.h>
#include <QtCore/qdebug.h>
diff --git a/src/declarative/util/qmlstateoperations.cpp b/src/declarative/util/qmlstateoperations.cpp
index bd1f5f0..fff8774 100644
--- a/src/declarative/util/qmlstateoperations.cpp
+++ b/src/declarative/util/qmlstateoperations.cpp
@@ -373,7 +373,6 @@ void QmlStateChangeScript::execute()
const QString &script = d->script.script();
if (!script.isEmpty()) {
QmlExpression expr(d->script.context(), script, d->script.scopeObject());
- expr.setTrackChange(false);
expr.value();
}
}
diff --git a/src/declarative/util/qmltransitionmanager.cpp b/src/declarative/util/qmltransitionmanager.cpp
index f2a4d64..60d9a60 100644
--- a/src/declarative/util/qmltransitionmanager.cpp
+++ b/src/declarative/util/qmltransitionmanager.cpp
@@ -43,7 +43,7 @@
#include "qmlstate_p_p.h"
-#include <qmlbinding.h>
+#include <qmlbinding_p.h>
#include <qmlglobal_p.h>
QT_BEGIN_NAMESPACE
diff --git a/tests/auto/declarative/qmldebug/tst_qmldebug.cpp b/tests/auto/declarative/qmldebug/tst_qmldebug.cpp
index ba07331..2f1a557 100644
--- a/tests/auto/declarative/qmldebug/tst_qmldebug.cpp
+++ b/tests/auto/declarative/qmldebug/tst_qmldebug.cpp
@@ -51,8 +51,8 @@
#include <QtDeclarative/qmlexpression.h>
#include <QtDeclarative/qmlmetatype.h>
#include <QtDeclarative/qmlmetaproperty.h>
-#include <QtDeclarative/qmlbinding.h>
+#include <private/qmlbinding_p.h>
#include <private/qmldebug_p.h>
#include <private/qmlenginedebug_p.h>
#include <private/qmldebugclient_p.h>
diff --git a/tests/auto/declarative/qmlecmascript/testtypes.h b/tests/auto/declarative/qmlecmascript/testtypes.h
index 0af72cb..f511c29 100644
--- a/tests/auto/declarative/qmlecmascript/testtypes.h
+++ b/tests/auto/declarative/qmlecmascript/testtypes.h
@@ -173,17 +173,21 @@ QML_DECLARE_TYPE(MyQmlContainer);
class MyExpression : public QmlExpression
{
+ Q_OBJECT
public:
MyExpression(QmlContext *ctxt, const QString &expr)
: QmlExpression(ctxt, expr, 0), changed(false)
{
+ QObject::connect(this, SIGNAL(valueChanged()), this, SLOT(expressionValueChanged()));
+ setNotifyOnValueChanged(true);
}
- void emitValueChanged() {
+ bool changed;
+
+public slots:
+ void expressionValueChanged() {
changed = true;
- QmlExpression::emitValueChanged();
}
- bool changed;
};
diff --git a/tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp b/tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp
index 13ed41d..0876520 100644
--- a/tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp
+++ b/tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp
@@ -1322,7 +1322,6 @@ T *tst_QmlGraphicsListView::findItem(QGraphicsObject *parent, const QString &obj
if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) {
if (index != -1) {
QmlExpression e(qmlContext(item), "index", item);
- e.setTrackChange(false);
if (e.value().toInt() == index)
return static_cast<T*>(item);
} else {
diff --git a/tests/auto/declarative/qmlgraphicspathview/tst_qmlgraphicspathview.cpp b/tests/auto/declarative/qmlgraphicspathview/tst_qmlgraphicspathview.cpp
index b986a64..62b3cfc 100644
--- a/tests/auto/declarative/qmlgraphicspathview/tst_qmlgraphicspathview.cpp
+++ b/tests/auto/declarative/qmlgraphicspathview/tst_qmlgraphicspathview.cpp
@@ -452,7 +452,6 @@ T *tst_QmlGraphicsPathView::findItem(QGraphicsObject *parent, const QString &obj
if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) {
if (index != -1) {
QmlExpression e(qmlContext(item), "index", item);
- e.setTrackChange(false);
if (e.value().toInt() == index)
return static_cast<T*>(item);
} else {
diff --git a/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp b/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp
index c289641..540d658 100644
--- a/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp
+++ b/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp
@@ -43,7 +43,7 @@
#include <QtDeclarative/qmlcomponent.h>
#include <QtDeclarative/qmlmetaproperty.h>
#include <private/qguard_p.h>
-#include <QtDeclarative/qmlbinding.h>
+#include <private/qmlbinding_p.h>
#include <QtGui/QLineEdit>
class MyQmlObject : public QObject