summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-05-18 07:00:40 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-05-18 07:00:40 (GMT)
commitba9218a9786abddd461034b5aeb1d5a39f8072f9 (patch)
treec494a78c355803285e4efa4e9d489babb9cd8fea
parent379b4dc81177b95c15de30c5925efca1136e4041 (diff)
parent633a5cf6d8197105d6392dbf56bf0f29f9c84da1 (diff)
downloadQt-ba9218a9786abddd461034b5aeb1d5a39f8072f9.zip
Qt-ba9218a9786abddd461034b5aeb1d5a39f8072f9.tar.gz
Qt-ba9218a9786abddd461034b5aeb1d5a39f8072f9.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: (22 commits) Regression fix for Loader anchors not working Make Qt.include() work for js files that have '.pragma library' doc fix Improve docs for Qt.quit() Prevent assignment of values (string, number, bool) to signal handlers. Make sure strings are escaped when returned via asScript. Documentation git ignore stuff Test Qt.labs.folderlistmodel plugin Fix naming. Sometimes you own QNetworkReply, sometimes you don't. Rename files; fix test. Add parent parameter to QDeclarativeExpression constructor. Round correctly in binding optimizer Don't disable SmoothPixmapTransform in qDrawBorderPixmap() Photoviewer example fixes. Port from QListModelInterface to QAbstractListModel. Use QDeclarativeScriptString for ParentChange. Set raster + gl viewport as the default for OS X. Move stuff from QML viewer to plugins. ...
-rw-r--r--.gitignore1
-rw-r--r--demos/declarative/photoviewer/PhotoViewerCore/Button.qml4
-rw-r--r--demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml40
-rw-r--r--demos/declarative/rssnews/rssnews.qmlproject16
-rw-r--r--doc/src/declarative/examples.qdoc4
-rw-r--r--doc/src/declarative/extending.qdoc5
-rw-r--r--doc/src/declarative/globalobject.qdoc5
-rw-r--r--doc/src/declarative/qdeclarativemodels.qdoc23
-rw-r--r--doc/src/examples/qml-examples.qdoc7
-rw-r--r--doc/src/examples/qml-rssnews.qdoc49
-rw-r--r--doc/src/images/qml-rssnews-example.pngbin0 -> 143314 bytes
-rw-r--r--src/declarative/QmlChanges.txt5
-rw-r--r--src/declarative/graphicsitems/qdeclarativeloader.cpp1
-rw-r--r--src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp6
-rw-r--r--src/declarative/qml/qdeclarativebinding.cpp4
-rw-r--r--src/declarative/qml/qdeclarativeboundsignal.cpp2
-rw-r--r--src/declarative/qml/qdeclarativecompiledbindings.cpp2
-rw-r--r--src/declarative/qml/qdeclarativecompiler.cpp51
-rw-r--r--src/declarative/qml/qdeclarativeenginedebug.cpp2
-rw-r--r--src/declarative/qml/qdeclarativeexpression.cpp18
-rw-r--r--src/declarative/qml/qdeclarativeexpression.h6
-rw-r--r--src/declarative/qml/qdeclarativeinclude.cpp3
-rw-r--r--src/declarative/qml/qdeclarativeparser.cpp45
-rw-r--r--src/declarative/qml/qdeclarativeparser_p.h4
-rw-r--r--src/declarative/qml/qdeclarativevme.cpp2
-rw-r--r--src/declarative/qml/qdeclarativewatcher.cpp2
-rw-r--r--src/declarative/qml/qdeclarativeworkerscript.cpp4
-rw-r--r--src/declarative/qml/qdeclarativexmlhttprequest.cpp2
-rw-r--r--src/declarative/util/qdeclarativeanimation.cpp2
-rw-r--r--src/declarative/util/qdeclarativeconnections.cpp2
-rw-r--r--src/declarative/util/qdeclarativepropertychanges.cpp4
-rw-r--r--src/declarative/util/qdeclarativestateoperations.cpp194
-rw-r--r--src/declarative/util/qdeclarativestateoperations_p.h36
-rw-r--r--src/gui/painting/qdrawutil.cpp6
-rw-r--r--src/imports/folderlistmodel/folderlistmodel.pro26
-rw-r--r--src/imports/folderlistmodel/plugin.cpp65
-rw-r--r--src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp (renamed from tools/qml/qdeclarativefolderlistmodel.cpp)84
-rw-r--r--src/imports/folderlistmodel/qdeclarativefolderlistmodel.h (renamed from tools/qml/qdeclarativefolderlistmodel.h)20
-rw-r--r--src/imports/folderlistmodel/qmldir1
-rw-r--r--src/imports/gestures/qdeclarativegesturearea.cpp2
-rw-r--r--src/imports/imports.pro2
-rw-r--r--tests/.gitignore (renamed from tests/auto/declarative/.gitignore)1
-rw-r--r--tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/include_pragma.qml11
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/include_pragma_inner.js5
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/include_pragma_outer.js6
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/testtypes.h2
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp16
-rw-r--r--tests/auto/declarative/qdeclarativefolderlistmodel/data/basic.qml5
-rw-r--r--tests/auto/declarative/qdeclarativefolderlistmodel/data/dummy.qml1
-rw-r--r--tests/auto/declarative/qdeclarativefolderlistmodel/qdeclarativefolderlistmodel.pro17
-rw-r--r--tests/auto/declarative/qdeclarativefolderlistmodel/tst_qdeclarativefolderlistmodel.cpp113
-rw-r--r--tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/assignValueToSignal.errors.txt1
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/assignValueToSignal.qml (renamed from tests/auto/declarative/qdeclarativelanguage/data/emptySignal.2.qml)3
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/emptySignal.2.errors.txt1
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/emptySignal.errors.txt2
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/emptySignal.qml3
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/scriptString2.qml5
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/scriptString3.qml5
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/scriptString4.qml5
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp55
-rw-r--r--tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp4
-rw-r--r--tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativeloader/data/AnchoredLoader.qml14
-rw-r--r--tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp22
-rw-r--r--tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp2
-rw-r--r--tests/auto/declarative/qmlvisual/animation/parentAnimation2/data/parentAnimation2.0.pngbin0 -> 2046 bytes
-rw-r--r--tests/auto/declarative/qmlvisual/animation/parentAnimation2/data/parentAnimation2.1.pngbin0 -> 2059 bytes
-rw-r--r--tests/auto/declarative/qmlvisual/animation/parentAnimation2/data/parentAnimation2.2.pngbin0 -> 2052 bytes
-rw-r--r--tests/auto/declarative/qmlvisual/animation/parentAnimation2/data/parentAnimation2.3.pngbin0 -> 2011 bytes
-rw-r--r--tests/auto/declarative/qmlvisual/animation/parentAnimation2/data/parentAnimation2.qml1023
-rw-r--r--tests/auto/declarative/qmlvisual/animation/parentAnimation2/parentAnimation2.qml64
-rw-r--r--tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp1
-rw-r--r--tools/qml/content/Browser.qml1
-rw-r--r--tools/qml/main.cpp8
-rw-r--r--tools/qml/qml.pri2
-rw-r--r--tools/qml/qmlruntime.cpp1
79 files changed, 1883 insertions, 281 deletions
diff --git a/.gitignore b/.gitignore
index 5707371..fd7b495 100644
--- a/.gitignore
+++ b/.gitignore
@@ -58,6 +58,7 @@ bin/lrelease*
bin/lupdate*
bin/lconvert*
bin/moc*
+bin/makeqpf*
bin/pixeltool*
bin/qmake*
bin/qdoc3*
diff --git a/demos/declarative/photoviewer/PhotoViewerCore/Button.qml b/demos/declarative/photoviewer/PhotoViewerCore/Button.qml
index c681064..5be096a 100644
--- a/demos/declarative/photoviewer/PhotoViewerCore/Button.qml
+++ b/demos/declarative/photoviewer/PhotoViewerCore/Button.qml
@@ -4,7 +4,7 @@ Item {
id: container
property alias label: labelText.text
- property color tint: "#FFFFFFFF"
+ property string tint: ""
signal clicked
width: labelText.width + 70 ; height: labelText.height + 18
@@ -19,7 +19,7 @@ Item {
Rectangle {
anchors.fill: container; color: container.tint; visible: container.tint != ""
- opacity: 0.1; smooth: true
+ opacity: 0.25; smooth: true
}
Text { id: labelText; font.pixelSize: 15; anchors.centerIn: parent; smooth: true }
diff --git a/demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml b/demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml
index ccfda02..15ffe56 100644
--- a/demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml
+++ b/demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml
@@ -4,11 +4,10 @@ Item {
id: container
property string label
- property color tint: "#FFFFFFFF"
signal clicked
signal labelChanged(string label)
- width: labelText.width + 70 ; height: labelText.height + 18
+ width: textInput.width + 70 ; height: textInput.height + 18
BorderImage {
anchors { fill: container; leftMargin: -6; topMargin: -6; rightMargin: -8; bottomMargin: -8 }
@@ -18,36 +17,25 @@ Item {
Image { anchors.fill: parent; source: "images/cardboard.png"; smooth: true }
- Rectangle {
- anchors.fill: container; color: container.tint; visible: container.tint != ""
- opacity: 0.1; smooth: true
- }
-
- Text { id: labelText; text: label; font.pixelSize: 15; anchors.centerIn: parent; smooth: true }
-
TextInput {
- id: textInput; text: label; font.pixelSize: 15; anchors.centerIn: parent; smooth: true; visible: false
- Keys.onReturnPressed: container.labelChanged(textInput.text)
+ id: textInput; text: label; font.pixelSize: 15; anchors.centerIn: parent; smooth: true
+ Keys.onReturnPressed: {
+ container.labelChanged(textInput.text)
+ container.focus = true
+ }
Keys.onEscapePressed: {
- textInput.text = labelText.text
- container.state = ''
+ textInput.text = container.label
+ container.focus = true
}
}
- MouseArea {
- anchors { fill: parent; leftMargin: -20; topMargin: -20; rightMargin: -20; bottomMargin: -20 }
- onClicked: container.state = "editMode"
- }
-
- states: State {
- name: "editMode"
- PropertyChanges { target: container; width: textInput.width + 70; height: textInput.height + 17 }
- PropertyChanges { target: textInput; visible: true; focus: true }
- PropertyChanges { target: labelText; visible: false }
+ Rectangle {
+ anchors.fill: container; border.color: "steelblue"; border.width: 4
+ color: "transparent"; visible: textInput.focus; smooth: true
}
- onLabelChanged: {
- labelText.text = label
- container.state = ''
+ MouseArea {
+ anchors { fill: parent; leftMargin: -20; topMargin: -20; rightMargin: -20; bottomMargin: -20 }
+ onClicked: textInput.forceFocus()
}
}
diff --git a/demos/declarative/rssnews/rssnews.qmlproject b/demos/declarative/rssnews/rssnews.qmlproject
new file mode 100644
index 0000000..d4909f8
--- /dev/null
+++ b/demos/declarative/rssnews/rssnews.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.0
+
+Project {
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+ /* List of plugin directories passed to QML runtime */
+ // importPaths: [ " ../exampleplugin " ]
+}
diff --git a/doc/src/declarative/examples.qdoc b/doc/src/declarative/examples.qdoc
index cdc308a..a65614e 100644
--- a/doc/src/declarative/examples.qdoc
+++ b/doc/src/declarative/examples.qdoc
@@ -122,7 +122,6 @@ For example, from your build directory, run:
\section2 XML
\list
-\o \l{declarative/xml/xmldata}{XML data}
\o \l{declarative/xml/xmlhttprequest}{XmlHttpRequest}
\endlist
@@ -161,9 +160,10 @@ For example, from your build directory, run:
\list
\o \l{demos/declarative/calculator}{Calculator}
+\o \l{demos/declarative/flickr}{Flickr Mobile}
\o \l{demos/declarative/minehunt}{Minehunt}
\o \l{demos/declarative/photoviewer}{Photo Viewer}
-\o \l{demos/declarative/flickr}{Flickr Mobile}
+\o \l{demos/declarative/rssnews}{RSS News Reader}
\o \l{demos/declarative/samegame}{Same Game}
\o \l{demos/declarative/snake}{Snake}
\endlist
diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc
index 5b695f7..574b0b2 100644
--- a/doc/src/declarative/extending.qdoc
+++ b/doc/src/declarative/extending.qdoc
@@ -61,8 +61,11 @@ QML for their own independent use.
The QML snippet shown above instantiates one \c Person instance and sets
the \c name and \c shoeSize properties on it. Everything in QML ultimately comes down
to either instantiating an object instance, or assigning a property a value.
+
QML relies heavily on Qt's meta object system and can only instantiate classes
-that derive from QObject.
+that derive from QObject. For visual element types, this will usually mean a subclass
+of QDeclarativeItem; for models used with the view elements, a subclass of QAbstractItemModel;
+and for abitrary objects with properties, a direct subclass of QObject.
The QML engine has no intrinsic knowledge of any class types. Instead the
programmer must register the C++ types with their corresponding QML names.
diff --git a/doc/src/declarative/globalobject.qdoc b/doc/src/declarative/globalobject.qdoc
index 2a83e30..c29a796 100644
--- a/doc/src/declarative/globalobject.qdoc
+++ b/doc/src/declarative/globalobject.qdoc
@@ -219,8 +219,9 @@ Binary to ASCII - this function returns a base64 encoding of \c data.
ASCII to binary - this function returns a base64 decoding of \c data.
\section3 Qt.quit()
-This function causes the QML engine to emit the quit signal, which in
-\l {Qt Declarative UI Runtime}{qml} causes the runtime to quit.
+This function causes the QDeclarativeEngine::quit() signal to be emitted.
+Within the \l {Qt Declarative UI Runtime}{qml} application this causes the
+launcher application to exit.
\section3 Qt.resolvedUrl(url)
This function returns \c url resolved relative to the URL of the
diff --git a/doc/src/declarative/qdeclarativemodels.qdoc b/doc/src/declarative/qdeclarativemodels.qdoc
index 788d417..109d390 100644
--- a/doc/src/declarative/qdeclarativemodels.qdoc
+++ b/doc/src/declarative/qdeclarativemodels.qdoc
@@ -99,7 +99,8 @@ There are a number of QML elements that operate using data models:
\endlist
QML supports several types of data model, which may be provided by QML
-or C++ (via QDeclarativeContext::setContextProperty(), for example).
+or C++ (via QDeclarativeContext::setContextProperty() or as plugin types,
+for example).
\section1 QML Data Models
@@ -210,8 +211,13 @@ will be positioned by the view.
\section1 C++ Data Models
+Models defined in C++ can be made available to QML either from a C++ application or from a
+\l{QDeclarativeExtensionPlugin}{QML C++ plugin}.
+
\section2 QAbstractItemModel
+A model can be defined by subclassing QAbstractItemModel.
+
QAbstractItemModel provides the roles set via the QAbstractItemModel::setRoleNames() method.
The default role names set by Qt are:
@@ -227,7 +233,18 @@ The default role names set by Qt are:
\o decoration
\endtable
-QAbstractItemModel presents a heirachy of tables. Views currently provided by QML
+The model could be made available to QML either directly:
+
+\code
+QDeclarativeContext *ctxt = view.rootContext();
+MyModel *model = new MyModel; // subclass of QAbstractItemModel
+ctxt->setContextProperty("myModel", model);
+\endcode
+
+or by registering the subclass as a new QML type in
+a \l{QDeclarativeExtensionPlugin}{QML C++ plugin}.
+
+QAbstractItemModel presents a heirachy of tables, but views currently provided by QML
can only display list data.
In order to display child lists of a heirachical model
the VisualDataModel element provides several properties and functions for use
@@ -242,7 +259,7 @@ with models of type QAbstractItemModel:
\section2 QStringList
-QStringList provides the contents of the list via the \e modelData role:
+A model may be a simple QStringList, which provides the contents of the list via the \e modelData role:
\table
\row
diff --git a/doc/src/examples/qml-examples.qdoc b/doc/src/examples/qml-examples.qdoc
index 22113ee..cad713e 100644
--- a/doc/src/examples/qml-examples.qdoc
+++ b/doc/src/examples/qml-examples.qdoc
@@ -175,7 +175,7 @@
*/
/*!
- \title Threaded ListModel
+ \title Threaded ListModel
\example declarative/threading/threadedlistmodel
*/
@@ -268,11 +268,6 @@
*/
/*!
- \title XML Data
- \example declarative/xml/xmldata
-*/
-
-/*!
\title XMLHttpRequest
\example declarative/xml/xmlhttprequest
*/
diff --git a/doc/src/examples/qml-rssnews.qdoc b/doc/src/examples/qml-rssnews.qdoc
new file mode 100644
index 0000000..0e7bdef
--- /dev/null
+++ b/doc/src/examples/qml-rssnews.qdoc
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** 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 documentation 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$
+**
+****************************************************************************/
+
+/*!
+ \title RSS News
+ \example demos/declarative/rssnews
+
+ This demo shows how to write a RSS news reader in QML.
+
+ \image qml-rssnews-example.png
+*/
diff --git a/doc/src/images/qml-rssnews-example.png b/doc/src/images/qml-rssnews-example.png
new file mode 100644
index 0000000..948ef4d
--- /dev/null
+++ b/doc/src/images/qml-rssnews-example.png
Binary files differ
diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt
index ec8f508..b1f4f1b 100644
--- a/src/declarative/QmlChanges.txt
+++ b/src/declarative/QmlChanges.txt
@@ -18,6 +18,11 @@ C++ API
QDeclarativeExpression::value() has been renamed to
QDeclarativeExpression::evaluate()
+The QDeclarativeExpression constructor has changed from
+ QDeclarativeExpression(context, expression, scope)
+to
+ QDeclarativeExpression(context, scope, expression, parent = 0)
+
QML Launcher
------------
The standalone executable has been renamed to qml launcher. Runtime warnings
diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp
index cbdfd87..94983c4 100644
--- a/src/declarative/graphicsitems/qdeclarativeloader.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp
@@ -366,6 +366,7 @@ QDeclarativeLoader::Status QDeclarativeLoader::status() const
void QDeclarativeLoader::componentComplete()
{
+ QDeclarativeItem::componentComplete();
if (status() == Ready)
emit loaded();
}
diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
index 0e4217e..7abd0a2 100644
--- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
+++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
@@ -204,7 +204,7 @@ QVariant QDeclarativeVisualItemModel::evaluate(int index, const QString &express
QDeclarativeContext *ccontext = qmlContext(this);
QDeclarativeContext *ctxt = new QDeclarativeContext(ccontext);
ctxt->setContextObject(d->children.at(index));
- QDeclarativeExpression e(ctxt, expression, objectContext);
+ QDeclarativeExpression e(ctxt, objectContext, expression);
QVariant value = e.evaluate();
delete ctxt;
return value;
@@ -1176,7 +1176,7 @@ QVariant QDeclarativeVisualDataModel::evaluate(int index, const QString &express
if (nobj) {
QDeclarativeItem *item = qobject_cast<QDeclarativeItem *>(nobj);
if (item) {
- QDeclarativeExpression e(qmlContext(item), expression, objectContext);
+ QDeclarativeExpression e(qmlContext(item), objectContext, expression);
value = e.evaluate();
}
} else {
@@ -1185,7 +1185,7 @@ QVariant QDeclarativeVisualDataModel::evaluate(int index, const QString &express
QDeclarativeContext *ctxt = new QDeclarativeContext(ccontext);
QDeclarativeVisualDataModelData *data = new QDeclarativeVisualDataModelData(index, this);
ctxt->setContextObject(data);
- QDeclarativeExpression e(ctxt, expression, objectContext);
+ QDeclarativeExpression e(ctxt, objectContext, expression);
value = e.evaluate();
delete data;
delete ctxt;
diff --git a/src/declarative/qml/qdeclarativebinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp
index 2e905b9..8230941 100644
--- a/src/declarative/qml/qdeclarativebinding.cpp
+++ b/src/declarative/qml/qdeclarativebinding.cpp
@@ -88,7 +88,7 @@ QDeclarativeBinding::QDeclarativeBinding(void *data, QDeclarativeRefCount *rc, Q
QDeclarativeBinding::QDeclarativeBinding(const QString &str, QObject *obj, QDeclarativeContext *ctxt,
QObject *parent)
-: QDeclarativeExpression(QDeclarativeContextData::get(ctxt), str, obj, *new QDeclarativeBindingPrivate)
+: QDeclarativeExpression(QDeclarativeContextData::get(ctxt), obj, str, *new QDeclarativeBindingPrivate)
{
setParent(parent);
setNotifyOnValueChanged(true);
@@ -96,7 +96,7 @@ QDeclarativeBinding::QDeclarativeBinding(const QString &str, QObject *obj, QDecl
QDeclarativeBinding::QDeclarativeBinding(const QString &str, QObject *obj, QDeclarativeContextData *ctxt,
QObject *parent)
-: QDeclarativeExpression(ctxt, str, obj, *new QDeclarativeBindingPrivate)
+: QDeclarativeExpression(ctxt, obj, str, *new QDeclarativeBindingPrivate)
{
setParent(parent);
setNotifyOnValueChanged(true);
diff --git a/src/declarative/qml/qdeclarativeboundsignal.cpp b/src/declarative/qml/qdeclarativeboundsignal.cpp
index 89f1256..8769122 100644
--- a/src/declarative/qml/qdeclarativeboundsignal.cpp
+++ b/src/declarative/qml/qdeclarativeboundsignal.cpp
@@ -119,7 +119,7 @@ QDeclarativeBoundSignal::QDeclarativeBoundSignal(QDeclarativeContext *ctxt, cons
QDeclarative_setParent_noEvent(this, parent);
QMetaObject::connect(scope, m_signal.methodIndex(), this, evaluateIdx);
- m_expression = new QDeclarativeExpression(ctxt, val, scope);
+ m_expression = new QDeclarativeExpression(ctxt, scope, val);
}
QDeclarativeBoundSignal::~QDeclarativeBoundSignal()
diff --git a/src/declarative/qml/qdeclarativecompiledbindings.cpp b/src/declarative/qml/qdeclarativecompiledbindings.cpp
index f55d330..7ddc735 100644
--- a/src/declarative/qml/qdeclarativecompiledbindings.cpp
+++ b/src/declarative/qml/qdeclarativecompiledbindings.cpp
@@ -1200,7 +1200,7 @@ void QDeclarativeCompiledBindingsPrivate::run(int instrIndex,
const Register &input = registers[instr->unaryop.src];
Register &output = registers[instr->unaryop.output];
if (input.isUndefined()) output.setUndefined();
- else output.setint(int(input.getqreal()));
+ else output.setint(qRound(input.getqreal()));
}
break;
diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp
index a43b9ac..b5bf972 100644
--- a/src/declarative/qml/qdeclarativecompiler.cpp
+++ b/src/declarative/qml/qdeclarativecompiler.cpp
@@ -180,7 +180,7 @@ bool QDeclarativeCompiler::isSignalPropertyName(const QByteArray &name)
bool QDeclarativeCompiler::testLiteralAssignment(const QMetaProperty &prop,
QDeclarativeParser::Value *v)
{
- QString string = v->value.asScript();
+ QString string = v->value.asString();
if (!prop.isWritable())
COMPILE_EXCEPTION(v, tr("Invalid property assignment: \"%1\" is a read-only property").arg(QString::fromUtf8(prop.name())));
@@ -207,31 +207,31 @@ bool QDeclarativeCompiler::testLiteralAssignment(const QMetaProperty &prop,
break;
case QVariant::UInt:
{
- bool ok;
- string.toUInt(&ok);
- if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, tr("Invalid property assignment: unsigned int expected"));
+ bool ok = v->value.isNumber();
+ if (ok) {
+ double n = v->value.asNumber();
+ if (double(uint(n)) != n)
+ ok = false;
+ }
+ if (!ok) COMPILE_EXCEPTION(v, tr("Invalid property assignment: unsigned int expected"));
}
break;
case QVariant::Int:
{
- bool ok;
- string.toInt(&ok);
- if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, tr("Invalid property assignment: int expected"));
+ bool ok = v->value.isNumber();
+ if (ok) {
+ double n = v->value.asNumber();
+ if (double(int(n)) != n)
+ ok = false;
+ }
+ if (!ok) COMPILE_EXCEPTION(v, tr("Invalid property assignment: int expected"));
}
break;
case QMetaType::Float:
- {
- bool ok;
- string.toFloat(&ok);
- if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, tr("Invalid property assignment: float expected"));
- }
+ if (!v->value.isNumber()) COMPILE_EXCEPTION(v, tr("Invalid property assignment: float expected"));
break;
case QVariant::Double:
- {
- bool ok;
- string.toDouble(&ok);
- if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, tr("Invalid property assignment: double expected"));
- }
+ if (!v->value.isNumber()) COMPILE_EXCEPTION(v, tr("Invalid property assignment: double expected"));
break;
case QVariant::Color:
{
@@ -319,7 +319,7 @@ bool QDeclarativeCompiler::testLiteralAssignment(const QMetaProperty &prop,
void QDeclarativeCompiler::genLiteralAssignment(const QMetaProperty &prop,
QDeclarativeParser::Value *v)
{
- QString string = v->value.asScript();
+ QString string = v->value.asString();
QDeclarativeInstruction instr;
instr.line = v->location.start.line;
@@ -382,28 +382,28 @@ void QDeclarativeCompiler::genLiteralAssignment(const QMetaProperty &prop,
{
instr.type = QDeclarativeInstruction::StoreInteger;
instr.storeInteger.propertyIndex = prop.propertyIndex();
- instr.storeInteger.value = string.toUInt();
+ instr.storeInteger.value = uint(v->value.asNumber());
}
break;
case QVariant::Int:
{
instr.type = QDeclarativeInstruction::StoreInteger;
instr.storeInteger.propertyIndex = prop.propertyIndex();
- instr.storeInteger.value = string.toInt();
+ instr.storeInteger.value = int(v->value.asNumber());
}
break;
case QMetaType::Float:
{
instr.type = QDeclarativeInstruction::StoreFloat;
instr.storeFloat.propertyIndex = prop.propertyIndex();
- instr.storeFloat.value = string.toFloat();
+ instr.storeFloat.value = float(v->value.asNumber());
}
break;
case QVariant::Double:
{
instr.type = QDeclarativeInstruction::StoreDouble;
instr.storeDouble.propertyIndex = prop.propertyIndex();
- instr.storeDouble.value = string.toDouble();
+ instr.storeDouble.value = v->value.asNumber();
}
break;
case QVariant::Color:
@@ -1187,7 +1187,7 @@ bool QDeclarativeCompiler::buildComponent(QDeclarativeParser::Object *obj,
if (idProp) {
if (idProp->value || idProp->values.count() > 1 || idProp->values.at(0)->object)
COMPILE_EXCEPTION(idProp, tr("Invalid component id specification"));
- COMPILE_CHECK(checkValidId(idProp->values.first(), idProp->values.first()->primitive()));
+ COMPILE_CHECK(checkValidId(idProp->values.first(), idProp->values.first()->primitive()))
QString idVal = idProp->values.first()->primitive();
@@ -1316,6 +1316,9 @@ bool QDeclarativeCompiler::buildSignal(QDeclarativeParser::Property *prop, QDecl
} else {
prop->values.at(0)->type = Value::SignalExpression;
+ if (!prop->values.at(0)->value.isScript())
+ COMPILE_EXCEPTION(prop, tr("Cannot assign a value to a signal (expecting a script to be run)"));
+
QString script = prop->values.at(0)->value.asScript().trimmed();
if (script.isEmpty())
COMPILE_EXCEPTION(prop, tr("Empty signal assignment"));
@@ -1893,7 +1896,7 @@ bool QDeclarativeCompiler::buildScriptStringProperty(QDeclarativeParser::Propert
if (prop->values.count() > 1)
COMPILE_EXCEPTION(prop->values.at(1), tr( "Cannot assign multiple values to a script property"));
- if (prop->values.at(0)->object || !prop->values.at(0)->value.isScript())
+ if (prop->values.at(0)->object)
COMPILE_EXCEPTION(prop->values.at(0), tr( "Invalid property assignment: script expected"));
obj->addScriptStringProperty(prop, ctxt.stack);
diff --git a/src/declarative/qml/qdeclarativeenginedebug.cpp b/src/declarative/qml/qdeclarativeenginedebug.cpp
index 69e42f8..7ae0050 100644
--- a/src/declarative/qml/qdeclarativeenginedebug.cpp
+++ b/src/declarative/qml/qdeclarativeenginedebug.cpp
@@ -414,7 +414,7 @@ void QDeclarativeEngineDebugServer::messageReceived(const QByteArray &message)
QDeclarativeContext *context = qmlContext(object);
QVariant result;
if (object && context) {
- QDeclarativeExpression exprObj(context, expr, object);
+ QDeclarativeExpression exprObj(context, object, expr);
bool undefined = false;
QVariant value = exprObj.evaluate(&undefined);
if (undefined)
diff --git a/src/declarative/qml/qdeclarativeexpression.cpp b/src/declarative/qml/qdeclarativeexpression.cpp
index 5ceb918..b1aecfa 100644
--- a/src/declarative/qml/qdeclarativeexpression.cpp
+++ b/src/declarative/qml/qdeclarativeexpression.cpp
@@ -241,15 +241,17 @@ QDeclarativeExpression::QDeclarativeExpression(QDeclarativeContextData *ctxt, vo
}
/*!
- Create a QDeclarativeExpression object.
+ Create a QDeclarativeExpression object that is a child of \a parent.
The \a expression JavaScript will be executed in the \a ctxt QDeclarativeContext.
If specified, the \a scope object's properties will also be in scope during
the expression's execution.
*/
-QDeclarativeExpression::QDeclarativeExpression(QDeclarativeContext *ctxt, const QString &expression,
- QObject *scope)
-: QObject(*new QDeclarativeExpressionPrivate, 0)
+QDeclarativeExpression::QDeclarativeExpression(QDeclarativeContext *ctxt,
+ QObject *scope,
+ const QString &expression,
+ QObject *parent)
+: QObject(*new QDeclarativeExpressionPrivate, parent)
{
Q_D(QDeclarativeExpression);
d->init(QDeclarativeContextData::get(ctxt), expression, scope);
@@ -258,8 +260,8 @@ QDeclarativeExpression::QDeclarativeExpression(QDeclarativeContext *ctxt, const
/*!
\internal
*/
-QDeclarativeExpression::QDeclarativeExpression(QDeclarativeContextData *ctxt, const QString &expression,
- QObject *scope)
+QDeclarativeExpression::QDeclarativeExpression(QDeclarativeContextData *ctxt, QObject *scope,
+ const QString &expression)
: QObject(*new QDeclarativeExpressionPrivate, 0)
{
Q_D(QDeclarativeExpression);
@@ -267,8 +269,8 @@ QDeclarativeExpression::QDeclarativeExpression(QDeclarativeContextData *ctxt, co
}
/*! \internal */
-QDeclarativeExpression::QDeclarativeExpression(QDeclarativeContextData *ctxt, const QString &expression,
- QObject *scope, QDeclarativeExpressionPrivate &dd)
+QDeclarativeExpression::QDeclarativeExpression(QDeclarativeContextData *ctxt, QObject *scope,
+ const QString &expression, QDeclarativeExpressionPrivate &dd)
: QObject(dd, 0)
{
Q_D(QDeclarativeExpression);
diff --git a/src/declarative/qml/qdeclarativeexpression.h b/src/declarative/qml/qdeclarativeexpression.h
index 6c72e4d..a8c86da 100644
--- a/src/declarative/qml/qdeclarativeexpression.h
+++ b/src/declarative/qml/qdeclarativeexpression.h
@@ -64,7 +64,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeExpression : public QObject
Q_OBJECT
public:
QDeclarativeExpression();
- QDeclarativeExpression(QDeclarativeContext *, const QString &, QObject *);
+ QDeclarativeExpression(QDeclarativeContext *, QObject *, const QString &, QObject * = 0);
virtual ~QDeclarativeExpression();
QDeclarativeEngine *engine() const;
@@ -92,13 +92,13 @@ Q_SIGNALS:
void valueChanged();
protected:
- QDeclarativeExpression(QDeclarativeContextData *, const QString &, QObject *,
+ QDeclarativeExpression(QDeclarativeContextData *, QObject *, const QString &,
QDeclarativeExpressionPrivate &dd);
QDeclarativeExpression(QDeclarativeContextData *, void *, QDeclarativeRefCount *rc,
QObject *me, const QString &, int, QDeclarativeExpressionPrivate &dd);
private:
- QDeclarativeExpression(QDeclarativeContextData *, const QString &, QObject *);
+ QDeclarativeExpression(QDeclarativeContextData *, QObject *, const QString &);
Q_DISABLE_COPY(QDeclarativeExpression)
Q_DECLARE_PRIVATE(QDeclarativeExpression)
diff --git a/src/declarative/qml/qdeclarativeinclude.cpp b/src/declarative/qml/qdeclarativeinclude.cpp
index 619264a..e37b68b 100644
--- a/src/declarative/qml/qdeclarativeinclude.cpp
+++ b/src/declarative/qml/qdeclarativeinclude.cpp
@@ -140,6 +140,7 @@ void QDeclarativeInclude::finished()
scriptContext->pushScope(m_scope[1]);
scriptContext->setActivationObject(m_scope[1]);
+ QDeclarativeScriptParser::extractPragmas(code);
m_scriptEngine->evaluate(code, urlString, 1);
@@ -230,6 +231,7 @@ QScriptValue QDeclarativeInclude::include(QScriptContext *ctxt, QScriptEngine *e
QScriptValue scope = QScriptDeclarativeClass::scopeChainValue(ctxt, -5);
scriptContext->pushScope(scope);
scriptContext->setActivationObject(scope);
+ QDeclarativeScriptParser::extractPragmas(code);
engine->evaluate(code, urlString, 1);
@@ -291,6 +293,7 @@ QScriptValue QDeclarativeInclude::worker_include(QScriptContext *ctxt, QScriptEn
QScriptValue scope = QScriptDeclarativeClass::scopeChainValue(ctxt, -4);
scriptContext->pushScope(scope);
scriptContext->setActivationObject(scope);
+ QDeclarativeScriptParser::extractPragmas(code);
engine->evaluate(code, urlString, 1);
diff --git a/src/declarative/qml/qdeclarativeparser.cpp b/src/declarative/qml/qdeclarativeparser.cpp
index b38bd76..8d00ef8 100644
--- a/src/declarative/qml/qdeclarativeparser.cpp
+++ b/src/declarative/qml/qdeclarativeparser.cpp
@@ -57,6 +57,7 @@
#include <QPointF>
#include <QSizeF>
#include <QRectF>
+#include <QStringBuilder>
#include <QtDebug>
QT_BEGIN_NAMESPACE
@@ -310,6 +311,49 @@ double QDeclarativeParser::Variant::asNumber() const
return d;
}
+//reverse of Lexer::singleEscape()
+QString escapedString(const QString &string)
+{
+ QString tmp = QLatin1String("\"");
+ for (int i = 0; i < string.length(); ++i) {
+ const QChar &c = string.at(i);
+ switch(c.unicode()) {
+ case 0x08:
+ tmp += QLatin1String("\\b");
+ break;
+ case 0x09:
+ tmp += QLatin1String("\\t");
+ break;
+ case 0x0A:
+ tmp += QLatin1String("\\n");
+ break;
+ case 0x0B:
+ tmp += QLatin1String("\\v");
+ break;
+ case 0x0C:
+ tmp += QLatin1String("\\f");
+ break;
+ case 0x0D:
+ tmp += QLatin1String("\\r");
+ break;
+ case 0x22:
+ tmp += QLatin1String("\\\"");
+ break;
+ case 0x27:
+ tmp += QLatin1String("\\\'");
+ break;
+ case 0x5C:
+ tmp += QLatin1String("\\\\");
+ break;
+ default:
+ tmp += c;
+ break;
+ }
+ }
+ tmp += QLatin1Char('\"');
+ return tmp;
+}
+
QString QDeclarativeParser::Variant::asScript() const
{
switch(type()) {
@@ -324,6 +368,7 @@ QString QDeclarativeParser::Variant::asScript() const
else
return s;
case String:
+ return escapedString(s);
case Script:
return s;
}
diff --git a/src/declarative/qml/qdeclarativeparser_p.h b/src/declarative/qml/qdeclarativeparser_p.h
index 25777f5..d192f3a 100644
--- a/src/declarative/qml/qdeclarativeparser_p.h
+++ b/src/declarative/qml/qdeclarativeparser_p.h
@@ -307,8 +307,8 @@ namespace QDeclarativeParser
};
Type type;
- // ### Temporary
- QString primitive() const { return value.asScript(); }
+ // ### Temporary (for id only)
+ QString primitive() const { return value.isString() ? value.asString() : value.asScript(); }
// Primitive value
Variant value;
diff --git a/src/declarative/qml/qdeclarativevme.cpp b/src/declarative/qml/qdeclarativevme.cpp
index 8ba79a6..3247f85 100644
--- a/src/declarative/qml/qdeclarativevme.cpp
+++ b/src/declarative/qml/qdeclarativevme.cpp
@@ -627,7 +627,7 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack,
QDeclarativeBoundSignal *bs = new QDeclarativeBoundSignal(target, signal, target);
QDeclarativeExpression *expr =
- new QDeclarativeExpression(ctxt, primitives.at(instr.storeSignal.value), context);
+ new QDeclarativeExpression(ctxt, context, primitives.at(instr.storeSignal.value));
expr->setSourceLocation(comp->name, instr.line);
bs->setExpression(expr);
}
diff --git a/src/declarative/qml/qdeclarativewatcher.cpp b/src/declarative/qml/qdeclarativewatcher.cpp
index 842b3c4..da1419f 100644
--- a/src/declarative/qml/qdeclarativewatcher.cpp
+++ b/src/declarative/qml/qdeclarativewatcher.cpp
@@ -153,7 +153,7 @@ bool QDeclarativeWatcher::addWatch(int id, quint32 objectId, const QString &expr
QObject *object = QDeclarativeDebugService::objectForId(objectId);
QDeclarativeContext *context = qmlContext(object);
if (context) {
- QDeclarativeExpression *exprObj = new QDeclarativeExpression(context, expr, object);
+ QDeclarativeExpression *exprObj = new QDeclarativeExpression(context, object, expr);
exprObj->setNotifyOnValueChanged(true);
QDeclarativeWatchProxy *proxy = new QDeclarativeWatchProxy(id, exprObj, objectId, this);
exprObj->setParent(proxy);
diff --git a/src/declarative/qml/qdeclarativeworkerscript.cpp b/src/declarative/qml/qdeclarativeworkerscript.cpp
index 4b687a9..8182998 100644
--- a/src/declarative/qml/qdeclarativeworkerscript.cpp
+++ b/src/declarative/qml/qdeclarativeworkerscript.cpp
@@ -527,7 +527,7 @@ void QDeclarativeWorkerScriptEngine::run()
\snippet doc/src/snippets/declarative/workerscript.qml 0
The above worker script specifies a javascript file, "script.js", that handles
- the operations to be performed in the new thread:
+ the operations to be performed in the new thread. Here is \c script.js:
\qml
WorkerScript.onMessage = function(message) {
@@ -538,7 +538,7 @@ void QDeclarativeWorkerScriptEngine::run()
When the user clicks anywhere within the rectangle, \c sendMessage() is
called, triggering the \tt WorkerScript.onMessage() handler in
- \tt source.js. This in turn sends a reply message that is then received
+ \tt script.js. This in turn sends a reply message that is then received
by the \tt onMessage() handler of \tt myWorker.
*/
QDeclarativeWorkerScript::QDeclarativeWorkerScript(QObject *parent)
diff --git a/src/declarative/qml/qdeclarativexmlhttprequest.cpp b/src/declarative/qml/qdeclarativexmlhttprequest.cpp
index 80510f8..acd1f51 100644
--- a/src/declarative/qml/qdeclarativexmlhttprequest.cpp
+++ b/src/declarative/qml/qdeclarativexmlhttprequest.cpp
@@ -995,7 +995,7 @@ private:
int m_status;
QString m_statusText;
QNetworkRequest m_request;
- QNetworkReply *m_network;
+ QDeclarativeGuard<QNetworkReply> m_network;
void destroyNetwork();
QNetworkAccessManager *m_nam;
diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp
index 67440b6..3017e22 100644
--- a/src/declarative/util/qdeclarativeanimation.cpp
+++ b/src/declarative/util/qdeclarativeanimation.cpp
@@ -786,7 +786,7 @@ void QDeclarativeScriptActionPrivate::execute()
const QString &str = scriptStr.script();
if (!str.isEmpty()) {
- QDeclarativeExpression expr(scriptStr.context(), str, scriptStr.scopeObject());
+ QDeclarativeExpression expr(scriptStr.context(), scriptStr.scopeObject(), str);
QDeclarativeData *ddata = QDeclarativeData::get(q);
if (ddata && ddata->outerContext && !ddata->outerContext->url.isEmpty())
expr.setSourceLocation(ddata->outerContext->url.toString(), ddata->lineNumber);
diff --git a/src/declarative/util/qdeclarativeconnections.cpp b/src/declarative/util/qdeclarativeconnections.cpp
index ffa160f..808d196 100644
--- a/src/declarative/util/qdeclarativeconnections.cpp
+++ b/src/declarative/util/qdeclarativeconnections.cpp
@@ -262,7 +262,7 @@ void QDeclarativeConnections::connectSignals()
if (prop.isValid() && (prop.type() & QDeclarativeProperty::SignalProperty)) {
QDeclarativeBoundSignal *signal =
new QDeclarativeBoundSignal(target(), prop.method(), this);
- signal->setExpression(new QDeclarativeExpression(qmlContext(this), script, 0));
+ signal->setExpression(new QDeclarativeExpression(qmlContext(this), 0, script));
d->boundsignals += signal;
} else {
if (!d->ignoreUnknownSignals)
diff --git a/src/declarative/util/qdeclarativepropertychanges.cpp b/src/declarative/util/qdeclarativepropertychanges.cpp
index 12fef36..d99de7a 100644
--- a/src/declarative/util/qdeclarativepropertychanges.cpp
+++ b/src/declarative/util/qdeclarativepropertychanges.cpp
@@ -321,7 +321,7 @@ void QDeclarativePropertyChangesPrivate::decode()
QDeclarativeProperty prop = property(name); //### better way to check for signal property?
if (prop.type() & QDeclarativeProperty::SignalProperty) {
- QDeclarativeExpression *expression = new QDeclarativeExpression(qmlContext(q), data.toString(), object);
+ QDeclarativeExpression *expression = new QDeclarativeExpression(qmlContext(q), object, data.toString());
QDeclarativeData *ddata = QDeclarativeData::get(q);
if (ddata && ddata->outerContext && !ddata->outerContext->url.isEmpty())
expression->setSourceLocation(ddata->outerContext->url.toString(), ddata->lineNumber);
@@ -330,7 +330,7 @@ void QDeclarativePropertyChangesPrivate::decode()
handler->expression = expression;
signalReplacements << handler;
} else if (isScript) {
- QDeclarativeExpression *expression = new QDeclarativeExpression(qmlContext(q), data.toString(), object);
+ QDeclarativeExpression *expression = new QDeclarativeExpression(qmlContext(q), object, data.toString());
QDeclarativeData *ddata = QDeclarativeData::get(q);
if (ddata && ddata->outerContext && !ddata->outerContext->url.isEmpty())
expression->setSourceLocation(ddata->outerContext->url.toString(), ddata->lineNumber);
diff --git a/src/declarative/util/qdeclarativestateoperations.cpp b/src/declarative/util/qdeclarativestateoperations.cpp
index 0326f6d..b11c0c2 100644
--- a/src/declarative/util/qdeclarativestateoperations.cpp
+++ b/src/declarative/util/qdeclarativestateoperations.cpp
@@ -75,12 +75,12 @@ public:
QDeclarativeItem *rewindParent;
QDeclarativeItem *rewindStackBefore;
- QDeclarativeNullableValue<qreal> x;
- QDeclarativeNullableValue<qreal> y;
- QDeclarativeNullableValue<qreal> width;
- QDeclarativeNullableValue<qreal> height;
- QDeclarativeNullableValue<qreal> scale;
- QDeclarativeNullableValue<qreal> rotation;
+ QDeclarativeNullableValue<QDeclarativeScriptString> xString;
+ QDeclarativeNullableValue<QDeclarativeScriptString> yString;
+ QDeclarativeNullableValue<QDeclarativeScriptString> widthString;
+ QDeclarativeNullableValue<QDeclarativeScriptString> heightString;
+ QDeclarativeNullableValue<QDeclarativeScriptString> scaleString;
+ QDeclarativeNullableValue<QDeclarativeScriptString> rotationString;
void doChange(QDeclarativeItem *targetParent, QDeclarativeItem *stackBefore = 0);
};
@@ -196,112 +196,112 @@ QDeclarativeParentChange::~QDeclarativeParentChange()
These properties hold the new position, size, scale, and rotation
for the item in this state.
*/
-qreal QDeclarativeParentChange::x() const
+QDeclarativeScriptString QDeclarativeParentChange::x() const
{
Q_D(const QDeclarativeParentChange);
- return d->x.isNull ? qreal(0.) : d->x.value;
+ return d->xString.value;
}
-void QDeclarativeParentChange::setX(qreal x)
+void QDeclarativeParentChange::setX(QDeclarativeScriptString x)
{
Q_D(QDeclarativeParentChange);
- d->x = x;
+ d->xString = x;
}
bool QDeclarativeParentChange::xIsSet() const
{
Q_D(const QDeclarativeParentChange);
- return d->x.isValid();
+ return d->xString.isValid();
}
-qreal QDeclarativeParentChange::y() const
+QDeclarativeScriptString QDeclarativeParentChange::y() const
{
Q_D(const QDeclarativeParentChange);
- return d->y.isNull ? qreal(0.) : d->y.value;
+ return d->yString.value;
}
-void QDeclarativeParentChange::setY(qreal y)
+void QDeclarativeParentChange::setY(QDeclarativeScriptString y)
{
Q_D(QDeclarativeParentChange);
- d->y = y;
+ d->yString = y;
}
bool QDeclarativeParentChange::yIsSet() const
{
Q_D(const QDeclarativeParentChange);
- return d->y.isValid();
+ return d->yString.isValid();
}
-qreal QDeclarativeParentChange::width() const
+QDeclarativeScriptString QDeclarativeParentChange::width() const
{
Q_D(const QDeclarativeParentChange);
- return d->width.isNull ? qreal(0.) : d->width.value;
+ return d->widthString.value;
}
-void QDeclarativeParentChange::setWidth(qreal width)
+void QDeclarativeParentChange::setWidth(QDeclarativeScriptString width)
{
Q_D(QDeclarativeParentChange);
- d->width = width;
+ d->widthString = width;
}
bool QDeclarativeParentChange::widthIsSet() const
{
Q_D(const QDeclarativeParentChange);
- return d->width.isValid();
+ return d->widthString.isValid();
}
-qreal QDeclarativeParentChange::height() const
+QDeclarativeScriptString QDeclarativeParentChange::height() const
{
Q_D(const QDeclarativeParentChange);
- return d->height.isNull ? qreal(0.) : d->height.value;
+ return d->heightString.value;
}
-void QDeclarativeParentChange::setHeight(qreal height)
+void QDeclarativeParentChange::setHeight(QDeclarativeScriptString height)
{
Q_D(QDeclarativeParentChange);
- d->height = height;
+ d->heightString = height;
}
bool QDeclarativeParentChange::heightIsSet() const
{
Q_D(const QDeclarativeParentChange);
- return d->height.isValid();
+ return d->heightString.isValid();
}
-qreal QDeclarativeParentChange::scale() const
+QDeclarativeScriptString QDeclarativeParentChange::scale() const
{
Q_D(const QDeclarativeParentChange);
- return d->scale.isNull ? qreal(1.) : d->scale.value;
+ return d->scaleString.value;
}
-void QDeclarativeParentChange::setScale(qreal scale)
+void QDeclarativeParentChange::setScale(QDeclarativeScriptString scale)
{
Q_D(QDeclarativeParentChange);
- d->scale = scale;
+ d->scaleString = scale;
}
bool QDeclarativeParentChange::scaleIsSet() const
{
Q_D(const QDeclarativeParentChange);
- return d->scale.isValid();
+ return d->scaleString.isValid();
}
-qreal QDeclarativeParentChange::rotation() const
+QDeclarativeScriptString QDeclarativeParentChange::rotation() const
{
Q_D(const QDeclarativeParentChange);
- return d->rotation.isNull ? qreal(0.) : d->rotation.value;
+ return d->rotationString.value;
}
-void QDeclarativeParentChange::setRotation(qreal rotation)
+void QDeclarativeParentChange::setRotation(QDeclarativeScriptString rotation)
{
Q_D(QDeclarativeParentChange);
- d->rotation = rotation;
+ d->rotationString = rotation;
}
bool QDeclarativeParentChange::rotationIsSet() const
{
Q_D(const QDeclarativeParentChange);
- return d->rotation.isValid();
+ return d->rotationString.isValid();
}
QDeclarativeItem *QDeclarativeParentChange::originalParent() const
@@ -356,34 +356,118 @@ QDeclarativeStateOperation::ActionList QDeclarativeParentChange::actions()
a.event = this;
actions << a;
- if (d->x.isValid()) {
- QDeclarativeAction xa(d->target, QLatin1String("x"), x());
- actions << xa;
+ if (d->xString.isValid()) {
+ bool ok = false;
+ QString script = d->xString.value.script();
+ qreal x = script.toFloat(&ok);
+ if (ok) {
+ QDeclarativeAction xa(d->target, QLatin1String("x"), x);
+ actions << xa;
+ } else {
+ QDeclarativeBinding *newBinding = new QDeclarativeBinding(script, d->target, qmlContext(this));
+ newBinding->setTarget(QDeclarativeProperty(d->target, QLatin1String("x")));
+ QDeclarativeAction xa;
+ xa.property = newBinding->property();
+ xa.toBinding = newBinding;
+ xa.fromValue = xa.property.read();
+ xa.deletableToBinding = true;
+ actions << xa;
+ }
}
- if (d->y.isValid()) {
- QDeclarativeAction ya(d->target, QLatin1String("y"), y());
- actions << ya;
+ if (d->yString.isValid()) {
+ bool ok = false;
+ QString script = d->yString.value.script();
+ qreal y = script.toFloat(&ok);
+ if (ok) {
+ QDeclarativeAction ya(d->target, QLatin1String("y"), y);
+ actions << ya;
+ } else {
+ QDeclarativeBinding *newBinding = new QDeclarativeBinding(script, d->target, qmlContext(this));
+ newBinding->setTarget(QDeclarativeProperty(d->target, QLatin1String("y")));
+ QDeclarativeAction ya;
+ ya.property = newBinding->property();
+ ya.toBinding = newBinding;
+ ya.fromValue = ya.property.read();
+ ya.deletableToBinding = true;
+ actions << ya;
+ }
}
- if (d->scale.isValid()) {
- QDeclarativeAction sa(d->target, QLatin1String("scale"), scale());
- actions << sa;
+ if (d->scaleString.isValid()) {
+ bool ok = false;
+ QString script = d->scaleString.value.script();
+ qreal scale = script.toFloat(&ok);
+ if (ok) {
+ QDeclarativeAction sa(d->target, QLatin1String("scale"), scale);
+ actions << sa;
+ } else {
+ QDeclarativeBinding *newBinding = new QDeclarativeBinding(script, d->target, qmlContext(this));
+ newBinding->setTarget(QDeclarativeProperty(d->target, QLatin1String("scale")));
+ QDeclarativeAction sa;
+ sa.property = newBinding->property();
+ sa.toBinding = newBinding;
+ sa.fromValue = sa.property.read();
+ sa.deletableToBinding = true;
+ actions << sa;
+ }
}
- if (d->rotation.isValid()) {
- QDeclarativeAction ra(d->target, QLatin1String("rotation"), rotation());
- actions << ra;
+ if (d->rotationString.isValid()) {
+ bool ok = false;
+ QString script = d->rotationString.value.script();
+ qreal rotation = script.toFloat(&ok);
+ if (ok) {
+ QDeclarativeAction ra(d->target, QLatin1String("rotation"), rotation);
+ actions << ra;
+ } else {
+ QDeclarativeBinding *newBinding = new QDeclarativeBinding(script, d->target, qmlContext(this));
+ newBinding->setTarget(QDeclarativeProperty(d->target, QLatin1String("rotation")));
+ QDeclarativeAction ra;
+ ra.property = newBinding->property();
+ ra.toBinding = newBinding;
+ ra.fromValue = ra.property.read();
+ ra.deletableToBinding = true;
+ actions << ra;
+ }
}
- if (d->width.isValid()) {
- QDeclarativeAction wa(d->target, QLatin1String("width"), width());
- actions << wa;
+ if (d->widthString.isValid()) {
+ bool ok = false;
+ QString script = d->widthString.value.script();
+ qreal width = script.toFloat(&ok);
+ if (ok) {
+ QDeclarativeAction wa(d->target, QLatin1String("width"), width);
+ actions << wa;
+ } else {
+ QDeclarativeBinding *newBinding = new QDeclarativeBinding(script, d->target, qmlContext(this));
+ newBinding->setTarget(QDeclarativeProperty(d->target, QLatin1String("width")));
+ QDeclarativeAction wa;
+ wa.property = newBinding->property();
+ wa.toBinding = newBinding;
+ wa.fromValue = wa.property.read();
+ wa.deletableToBinding = true;
+ actions << wa;
+ }
}
- if (d->height.isValid()) {
- QDeclarativeAction ha(d->target, QLatin1String("height"), height());
- actions << ha;
+ if (d->heightString.isValid()) {
+ bool ok = false;
+ QString script = d->heightString.value.script();
+ qreal height = script.toFloat(&ok);
+ if (ok) {
+ QDeclarativeAction ha(d->target, QLatin1String("height"), height);
+ actions << ha;
+ } else {
+ QDeclarativeBinding *newBinding = new QDeclarativeBinding(script, d->target, qmlContext(this));
+ newBinding->setTarget(QDeclarativeProperty(d->target, QLatin1String("height")));
+ QDeclarativeAction ha;
+ ha.property = newBinding->property();
+ ha.toBinding = newBinding;
+ ha.fromValue = ha.property.read();
+ ha.deletableToBinding = true;
+ actions << ha;
+ }
}
return actions;
@@ -575,7 +659,7 @@ void QDeclarativeStateChangeScript::execute(Reason)
Q_D(QDeclarativeStateChangeScript);
const QString &script = d->script.script();
if (!script.isEmpty()) {
- QDeclarativeExpression expr(d->script.context(), script, d->script.scopeObject());
+ QDeclarativeExpression expr(d->script.context(), d->script.scopeObject(), script);
QDeclarativeData *ddata = QDeclarativeData::get(this);
if (ddata && ddata->outerContext && !ddata->outerContext->url.isEmpty())
expr.setSourceLocation(ddata->outerContext->url.toString(), ddata->lineNumber);
diff --git a/src/declarative/util/qdeclarativestateoperations_p.h b/src/declarative/util/qdeclarativestateoperations_p.h
index 21a86f5..05ad052 100644
--- a/src/declarative/util/qdeclarativestateoperations_p.h
+++ b/src/declarative/util/qdeclarativestateoperations_p.h
@@ -62,12 +62,12 @@ class Q_DECLARATIVE_EXPORT QDeclarativeParentChange : public QDeclarativeStateOp
Q_PROPERTY(QDeclarativeItem *target READ object WRITE setObject)
Q_PROPERTY(QDeclarativeItem *parent READ parent WRITE setParent)
- Q_PROPERTY(qreal x READ x WRITE setX)
- Q_PROPERTY(qreal y READ y WRITE setY)
- Q_PROPERTY(qreal width READ width WRITE setWidth)
- Q_PROPERTY(qreal height READ height WRITE setHeight)
- Q_PROPERTY(qreal scale READ scale WRITE setScale)
- Q_PROPERTY(qreal rotation READ rotation WRITE setRotation)
+ Q_PROPERTY(QDeclarativeScriptString x READ x WRITE setX)
+ Q_PROPERTY(QDeclarativeScriptString y READ y WRITE setY)
+ Q_PROPERTY(QDeclarativeScriptString width READ width WRITE setWidth)
+ Q_PROPERTY(QDeclarativeScriptString height READ height WRITE setHeight)
+ Q_PROPERTY(QDeclarativeScriptString scale READ scale WRITE setScale)
+ Q_PROPERTY(QDeclarativeScriptString rotation READ rotation WRITE setRotation)
public:
QDeclarativeParentChange(QObject *parent=0);
~QDeclarativeParentChange();
@@ -80,28 +80,28 @@ public:
QDeclarativeItem *originalParent() const;
- qreal x() const;
- void setX(qreal x);
+ QDeclarativeScriptString x() const;
+ void setX(QDeclarativeScriptString x);
bool xIsSet() const;
- qreal y() const;
- void setY(qreal y);
+ QDeclarativeScriptString y() const;
+ void setY(QDeclarativeScriptString y);
bool yIsSet() const;
- qreal width() const;
- void setWidth(qreal width);
+ QDeclarativeScriptString width() const;
+ void setWidth(QDeclarativeScriptString width);
bool widthIsSet() const;
- qreal height() const;
- void setHeight(qreal height);
+ QDeclarativeScriptString height() const;
+ void setHeight(QDeclarativeScriptString height);
bool heightIsSet() const;
- qreal scale() const;
- void setScale(qreal scale);
+ QDeclarativeScriptString scale() const;
+ void setScale(QDeclarativeScriptString scale);
bool scaleIsSet() const;
- qreal rotation() const;
- void setRotation(qreal rotation);
+ QDeclarativeScriptString rotation() const;
+ void setRotation(QDeclarativeScriptString rotation);
bool rotationIsSet() const;
virtual ActionList actions();
diff --git a/src/gui/painting/qdrawutil.cpp b/src/gui/painting/qdrawutil.cpp
index ef9b18c..3ce95ef 100644
--- a/src/gui/painting/qdrawutil.cpp
+++ b/src/gui/painting/qdrawutil.cpp
@@ -1138,12 +1138,10 @@ void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargin
yTarget.resize(rows + 1);
bool oldAA = painter->testRenderHint(QPainter::Antialiasing);
- bool oldSmooth = painter->testRenderHint(QPainter::SmoothPixmapTransform);
if (painter->paintEngine()->type() != QPaintEngine::OpenGL
&& painter->paintEngine()->type() != QPaintEngine::OpenGL2
- && (oldSmooth || oldAA) && painter->combinedTransform().type() != QTransform::TxNone) {
+ && oldAA && painter->combinedTransform().type() != QTransform::TxNone) {
painter->setRenderHint(QPainter::Antialiasing, false);
- painter->setRenderHint(QPainter::SmoothPixmapTransform, false);
}
xTarget[0] = targetRect.left();
@@ -1354,8 +1352,6 @@ void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargin
if (oldAA)
painter->setRenderHint(QPainter::Antialiasing, true);
- if (oldSmooth)
- painter->setRenderHint(QPainter::SmoothPixmapTransform, true);
}
QT_END_NAMESPACE
diff --git a/src/imports/folderlistmodel/folderlistmodel.pro b/src/imports/folderlistmodel/folderlistmodel.pro
new file mode 100644
index 0000000..781dfc2
--- /dev/null
+++ b/src/imports/folderlistmodel/folderlistmodel.pro
@@ -0,0 +1,26 @@
+TARGET = qmlfolderlistmodelplugin
+TARGETPATH = Qt/labs/folderlistmodel
+include(../qimportbase.pri)
+
+QT += declarative script
+
+SOURCES += qdeclarativefolderlistmodel.cpp plugin.cpp
+HEADERS += qdeclarativefolderlistmodel.h
+
+QTDIR_build:DESTDIR = $$QT_BUILD_TREE/imports/$$TARGETPATH
+target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH
+
+qmldir.files += $$PWD/qmldir
+qmldir.path += $$[QT_INSTALL_IMPORTS]/$$TARGETPATH
+
+symbian:{
+ load(data_caging_paths)
+ include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri)
+
+ importFiles.sources = qmlfolderlistmodelplugin.dll qmldir
+ importFiles.path = $$QT_IMPORTS_BASE_DIR/$$TARGETPATH
+
+ DEPLOYMENT = importFiles
+}
+
+INSTALLS += target qmldir
diff --git a/src/imports/folderlistmodel/plugin.cpp b/src/imports/folderlistmodel/plugin.cpp
new file mode 100644
index 0000000..b94efb0
--- /dev/null
+++ b/src/imports/folderlistmodel/plugin.cpp
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** 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 plugins 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$
+**
+****************************************************************************/
+
+#include <QtDeclarative/qdeclarativeextensionplugin.h>
+#include <QtDeclarative/qdeclarative.h>
+
+#include "qdeclarativefolderlistmodel.h"
+
+QT_BEGIN_NAMESPACE
+
+class QmlFolderListModelPlugin : public QDeclarativeExtensionPlugin
+{
+ Q_OBJECT
+public:
+ virtual void registerTypes(const char *uri)
+ {
+ Q_ASSERT(QLatin1String(uri) == QLatin1String("Qt.labs.folderlistmodel"));
+ qmlRegisterType<QDeclarativeFolderListModel>(uri,1,0,"FolderListModel");
+ }
+};
+
+QT_END_NAMESPACE
+
+#include "plugin.moc"
+
+Q_EXPORT_PLUGIN2(qmlfolderlistmodelplugin, QT_PREPEND_NAMESPACE(QmlFolderListModelPlugin));
+
diff --git a/tools/qml/qdeclarativefolderlistmodel.cpp b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp
index 7ac25d6..a16f0c6 100644
--- a/tools/qml/qdeclarativefolderlistmodel.cpp
+++ b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp
@@ -44,8 +44,6 @@
#include <QDebug>
#include <qdeclarativecontext.h>
-QT_BEGIN_NAMESPACE
-
class QDeclarativeFolderListModelPrivate
{
public:
@@ -112,8 +110,13 @@ public:
*/
QDeclarativeFolderListModel::QDeclarativeFolderListModel(QObject *parent)
- : QListModelInterface(parent)
+ : QAbstractListModel(parent)
{
+ QHash<int, QByteArray> roles;
+ roles[FileNameRole] = "fileName";
+ roles[FilePathRole] = "filePath";
+ setRoleNames(roles);
+
d = new QDeclarativeFolderListModelPrivate;
d->model.setFilter(QDir::AllDirs | QDir::Files | QDir::Drives | QDir::NoDotAndDotDot);
connect(&d->model, SIGNAL(rowsInserted(const QModelIndex&,int,int))
@@ -131,58 +134,25 @@ QDeclarativeFolderListModel::~QDeclarativeFolderListModel()
delete d;
}
-QHash<int,QVariant> QDeclarativeFolderListModel::data(int index, const QList<int> &roles) const
-{
- Q_UNUSED(roles);
- QHash<int,QVariant> folderData;
- QModelIndex modelIndex = d->model.index(index, 0, d->folderIndex);
- if (modelIndex.isValid()) {
- folderData[QDirModel::FileNameRole] = d->model.data(modelIndex, QDirModel::FileNameRole);
- folderData[QDirModel::FilePathRole] = QUrl::fromLocalFile(d->model.data(modelIndex, QDirModel::FilePathRole).toString());
- }
-
- return folderData;
-}
-
-QVariant QDeclarativeFolderListModel::data(int index, int role) const
+QVariant QDeclarativeFolderListModel::data(const QModelIndex &index, int role) const
{
QVariant rv;
- QModelIndex modelIndex = d->model.index(index, 0, d->folderIndex);
+ QModelIndex modelIndex = d->model.index(index.row(), 0, d->folderIndex);
if (modelIndex.isValid()) {
- if (role == QDirModel::FileNameRole)
- rv = d->model.data(modelIndex, QDirModel::FileNameRole);
- else if (role == QDirModel::FilePathRole)
+ if (role == FileNameRole)
+ rv = d->model.data(modelIndex, QDirModel::FileNameRole).toString();
+ else if (role == FilePathRole)
rv = QUrl::fromLocalFile(d->model.data(modelIndex, QDirModel::FilePathRole).toString());
}
-
return rv;
}
-int QDeclarativeFolderListModel::count() const
+int QDeclarativeFolderListModel::rowCount(const QModelIndex &parent) const
{
+ Q_UNUSED(parent);
return d->count;
}
-QList<int> QDeclarativeFolderListModel::roles() const
-{
- QList<int> r;
- r << QDirModel::FileNameRole;
- r << QDirModel::FilePathRole;
- return r;
-}
-
-QString QDeclarativeFolderListModel::toString(int role) const
-{
- switch (role) {
- case QDirModel::FileNameRole:
- return QLatin1String("fileName");
- case QDirModel::FilePathRole:
- return QLatin1String("filePath");
- }
-
- return QString();
-}
-
/*!
\qmlproperty string FolderListModel::folder
@@ -315,37 +285,41 @@ void QDeclarativeFolderListModel::refresh()
{
d->folderIndex = QModelIndex();
if (d->count) {
- int tmpCount = d->count;
+ emit beginRemoveRows(QModelIndex(), 0, d->count);
d->count = 0;
- emit itemsRemoved(0, tmpCount);
+ emit endRemoveRows();
}
d->folderIndex = d->model.index(d->folder.toLocalFile());
- d->count = d->model.rowCount(d->folderIndex);
- if (d->count) {
- emit itemsInserted(0, d->count);
+ int newcount = d->model.rowCount(d->folderIndex);
+ if (newcount) {
+ emit beginInsertRows(QModelIndex(), 0, newcount-1);
+ d->count = newcount;
+ emit endInsertRows();
}
}
void QDeclarativeFolderListModel::inserted(const QModelIndex &index, int start, int end)
{
if (index == d->folderIndex) {
+ emit beginInsertRows(QModelIndex(), start, end);
d->count = d->model.rowCount(d->folderIndex);
- emit itemsInserted(start, end - start + 1);
+ emit endInsertRows();
}
}
void QDeclarativeFolderListModel::removed(const QModelIndex &index, int start, int end)
{
if (index == d->folderIndex) {
+ emit beginRemoveRows(QModelIndex(), start, end);
d->count = d->model.rowCount(d->folderIndex);
- emit itemsRemoved(start, end - start + 1);
+ emit endRemoveRows();
}
}
void QDeclarativeFolderListModel::dataChanged(const QModelIndex &start, const QModelIndex &end)
{
if (start.parent() == d->folderIndex)
- emit itemsChanged(start.row(), end.row() - start.row() + 1, roles());
+ emit dataChanged(index(start.row(),0), index(end.row(),0));
}
/*!
@@ -413,11 +387,3 @@ void QDeclarativeFolderListModel::setShowOnlyReadable(bool on)
else
d->model.setFilter(d->model.filter() & ~QDir::Readable);
}
-
-void QDeclarativeFolderListModel::registerTypes()
-{
- qmlRegisterType<QDeclarativeFolderListModel>("Qt",4,7,"FolderListModel");
-}
-
-QT_END_NAMESPACE
-
diff --git a/tools/qml/qdeclarativefolderlistmodel.h b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.h
index 1ecc784..e610a14 100644
--- a/tools/qml/qdeclarativefolderlistmodel.h
+++ b/src/imports/folderlistmodel/qdeclarativefolderlistmodel.h
@@ -45,15 +45,13 @@
#include <qdeclarative.h>
#include <QStringList>
#include <QUrl>
-#include "../../src/declarative/3rdparty/qlistmodelinterface_p.h"
-
-QT_BEGIN_NAMESPACE
+#include <QAbstractListModel>
class QDeclarativeContext;
class QModelIndex;
class QDeclarativeFolderListModelPrivate;
-class QDeclarativeFolderListModel : public QListModelInterface, public QDeclarativeParserStatus
+class QDeclarativeFolderListModel : public QAbstractListModel, public QDeclarativeParserStatus
{
Q_OBJECT
Q_INTERFACES(QDeclarativeParserStatus)
@@ -66,18 +64,18 @@ class QDeclarativeFolderListModel : public QListModelInterface, public QDeclarat
Q_PROPERTY(bool showDirs READ showDirs WRITE setShowDirs)
Q_PROPERTY(bool showDotAndDotDot READ showDotAndDotDot WRITE setShowDotAndDotDot)
Q_PROPERTY(bool showOnlyReadable READ showOnlyReadable WRITE setShowOnlyReadable)
+ Q_PROPERTY(int count READ count)
public:
QDeclarativeFolderListModel(QObject *parent = 0);
~QDeclarativeFolderListModel();
- static void registerTypes();
+ enum Roles { FileNameRole = Qt::UserRole+1, FilePathRole = Qt::UserRole+2 };
+
+ int rowCount(const QModelIndex &parent) const;
+ QVariant data(const QModelIndex &index, int role) const;
- virtual QHash<int,QVariant> data(int index, const QList<int> &roles = (QList<int>())) const;
- virtual QVariant data(int index, int role) const;
- virtual int count() const;
- virtual QList<int> roles() const;
- virtual QString toString(int role) const;
+ int count() const { return rowCount(QModelIndex()); }
QUrl folder() const;
void setFolder(const QUrl &folder);
@@ -121,8 +119,6 @@ private:
QDeclarativeFolderListModelPrivate *d;
};
-QT_END_NAMESPACE
-
QML_DECLARE_TYPE(QDeclarativeFolderListModel)
#endif // QDECLARATIVEFOLDERLISTMODEL_H
diff --git a/src/imports/folderlistmodel/qmldir b/src/imports/folderlistmodel/qmldir
new file mode 100644
index 0000000..6e115bb
--- /dev/null
+++ b/src/imports/folderlistmodel/qmldir
@@ -0,0 +1 @@
+plugin qmlfolderlistmodelplugin
diff --git a/src/imports/gestures/qdeclarativegesturearea.cpp b/src/imports/gestures/qdeclarativegesturearea.cpp
index 19afe0c..1b0aeeb 100644
--- a/src/imports/gestures/qdeclarativegesturearea.cpp
+++ b/src/imports/gestures/qdeclarativegesturearea.cpp
@@ -226,7 +226,7 @@ void QDeclarativeGestureArea::connectSignals()
ds >> gesturetype;
QString script;
ds >> script;
- QDeclarativeExpression *exp = new QDeclarativeExpression(qmlContext(this), script, 0);
+ QDeclarativeExpression *exp = new QDeclarativeExpression(qmlContext(this), 0, script);
d->bindings.insert(Qt::GestureType(gesturetype),exp);
grabGesture(Qt::GestureType(gesturetype));
}
diff --git a/src/imports/imports.pro b/src/imports/imports.pro
index a9d600e..e937742 100644
--- a/src/imports/imports.pro
+++ b/src/imports/imports.pro
@@ -1,6 +1,6 @@
TEMPLATE = subdirs
-SUBDIRS += particles gestures
+SUBDIRS += folderlistmodel particles gestures
contains(QT_CONFIG, webkit): SUBDIRS += webkit
contains(QT_CONFIG, mediaservices): SUBDIRS += multimedia
diff --git a/tests/auto/declarative/.gitignore b/tests/.gitignore
index 57608cf..b203473 100644
--- a/tests/auto/declarative/.gitignore
+++ b/tests/.gitignore
@@ -1,3 +1,4 @@
+QObject.log
tst_*
!tst_*.*
tst_*.log
diff --git a/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp b/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp
index 851460f..7f0e6c0 100644
--- a/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp
+++ b/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp
@@ -398,7 +398,7 @@ void tst_qdeclarativecontext::destruction()
QObject obj;
QDeclarativeEngine::setContextForObject(&obj, ctxt);
- QDeclarativeExpression expr(ctxt, "a", 0);
+ QDeclarativeExpression expr(ctxt, 0, "a");
QCOMPARE(ctxt, QDeclarativeEngine::contextForObject(&obj));
QCOMPARE(ctxt, expr.context());
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include_pragma.qml b/tests/auto/declarative/qdeclarativeecmascript/data/include_pragma.qml
new file mode 100644
index 0000000..67b8cfd
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/include_pragma.qml
@@ -0,0 +1,11 @@
+import Qt 4.7
+import "include_pragma_outer.js" as Script
+
+Item {
+ property int test1
+
+ Component.onCompleted: {
+ test1 = Script.callFunction()
+ }
+}
+
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include_pragma_inner.js b/tests/auto/declarative/qdeclarativeecmascript/data/include_pragma_inner.js
new file mode 100644
index 0000000..a0380a2
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/include_pragma_inner.js
@@ -0,0 +1,5 @@
+.pragma library
+
+function getValue() {
+ return 100;
+}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include_pragma_outer.js b/tests/auto/declarative/qdeclarativeecmascript/data/include_pragma_outer.js
new file mode 100644
index 0000000..d87bafc
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/include_pragma_outer.js
@@ -0,0 +1,6 @@
+Qt.include("include_pragma_inner.js")
+
+function callFunction() {
+ return getValue();
+}
+
diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h
index 1381d57..7bb8a8e 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h
+++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h
@@ -190,7 +190,7 @@ class MyExpression : public QDeclarativeExpression
Q_OBJECT
public:
MyExpression(QDeclarativeContext *ctxt, const QString &expr)
- : QDeclarativeExpression(ctxt, expr, 0), changed(false)
+ : QDeclarativeExpression(ctxt, 0, expr), changed(false)
{
QObject::connect(this, SIGNAL(valueChanged()), this, SLOT(expressionValueChanged()));
setNotifyOnValueChanged(true);
diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
index 64e5b3f..9a88237 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
+++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
@@ -2083,10 +2083,9 @@ void tst_qdeclarativeecmascript::compiled()
QCOMPARE(object->property("test15").toBool(), false);
QCOMPARE(object->property("test16").toBool(), true);
- QCOMPARE(object->property("test17").toInt(), 4);
+ QCOMPARE(object->property("test17").toInt(), 5);
QCOMPARE(object->property("test18").toReal(), qreal(176));
- QEXPECT_FAIL("", "QTBUG-9538", Continue);
- QCOMPARE(object->property("test19").toInt(), 6);
+ QCOMPARE(object->property("test19").toInt(), 7);
QCOMPARE(object->property("test20").toReal(), qreal(6.7));
QCOMPARE(object->property("test21").toString(), QLatin1String("6.7"));
QCOMPARE(object->property("test22").toString(), QLatin1String("!"));
@@ -2425,6 +2424,17 @@ void tst_qdeclarativeecmascript::include()
delete o;
}
+ // Including file with ".pragma library"
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("include_pragma.qml"));
+ qDebug() << "errors:" << component.errorsString();
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ QCOMPARE(o->property("test1").toInt(), 100);
+
+ delete o;
+ }
+
// Remote - success
{
TestHTTPServer server(8111);
diff --git a/tests/auto/declarative/qdeclarativefolderlistmodel/data/basic.qml b/tests/auto/declarative/qdeclarativefolderlistmodel/data/basic.qml
new file mode 100644
index 0000000..2c4977d
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativefolderlistmodel/data/basic.qml
@@ -0,0 +1,5 @@
+import Qt.labs.folderlistmodel 1.0
+
+FolderListModel {
+ nameFilters: [ "*.qml" ]
+}
diff --git a/tests/auto/declarative/qdeclarativefolderlistmodel/data/dummy.qml b/tests/auto/declarative/qdeclarativefolderlistmodel/data/dummy.qml
new file mode 100644
index 0000000..609638b
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativefolderlistmodel/data/dummy.qml
@@ -0,0 +1 @@
+// This file is not used, it is just content for QDirModel
diff --git a/tests/auto/declarative/qdeclarativefolderlistmodel/qdeclarativefolderlistmodel.pro b/tests/auto/declarative/qdeclarativefolderlistmodel/qdeclarativefolderlistmodel.pro
new file mode 100644
index 0000000..487d0e1
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativefolderlistmodel/qdeclarativefolderlistmodel.pro
@@ -0,0 +1,17 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qdeclarativefolderlistmodel.cpp
+
+# Define SRCDIR equal to test's source directory
+symbian: {
+ DEFINES += SRCDIR=\".\"
+ importFiles.sources = data
+ importFiles.path =
+ DEPLOYMENT = importFiles
+} else {
+ DEFINES += SRCDIR=\\\"$$PWD\\\"
+}
+
+CONFIG += parallel_test
diff --git a/tests/auto/declarative/qdeclarativefolderlistmodel/tst_qdeclarativefolderlistmodel.cpp b/tests/auto/declarative/qdeclarativefolderlistmodel/tst_qdeclarativefolderlistmodel.cpp
new file mode 100644
index 0000000..8a8bfe7
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativefolderlistmodel/tst_qdeclarativefolderlistmodel.cpp
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** 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 test suite 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$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QtTest/QSignalSpy>
+#include "../../../shared/util.h"
+#include <QtDeclarative/qdeclarativeengine.h>
+#include <QtDeclarative/qdeclarativecomponent.h>
+#include <QtCore/qdir.h>
+#include <QtCore/qfile.h>
+#include <QtCore/qabstractitemmodel.h>
+#include <QDebug>
+
+// From qdeclarastivefolderlistmodel.h
+const int FileNameRole = Qt::UserRole+1;
+const int FilePathRole = Qt::UserRole+2;
+enum SortField { Unsorted, Name, Time, Size, Type };
+
+class tst_qdeclarativefolderlistmodel : public QObject
+{
+ Q_OBJECT
+public:
+ tst_qdeclarativefolderlistmodel() {}
+
+private slots:
+ void basicProperties();
+
+private:
+ void checkNoErrors(const QDeclarativeComponent& component);
+ QDeclarativeEngine engine;
+};
+
+void tst_qdeclarativefolderlistmodel::checkNoErrors(const QDeclarativeComponent& component)
+{
+ // Wait until the component is ready
+ QTRY_VERIFY(component.isReady() || component.isError());
+
+ if (component.isError()) {
+ QList<QDeclarativeError> errors = component.errors();
+ for (int ii = 0; ii < errors.count(); ++ii) {
+ const QDeclarativeError &error = errors.at(ii);
+ QByteArray errorStr = QByteArray::number(error.line()) + ":" +
+ QByteArray::number(error.column()) + ":" +
+ error.description().toUtf8();
+ qWarning() << errorStr;
+ }
+ }
+ QVERIFY(!component.isError());
+}
+
+void tst_qdeclarativefolderlistmodel::basicProperties()
+{
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/basic.qml"));
+ checkNoErrors(component);
+
+ QAbstractListModel *flm = qobject_cast<QAbstractListModel*>(component.create());
+ QVERIFY(flm != 0);
+
+
+ flm->setProperty("folder",QUrl::fromLocalFile(SRCDIR "/data"));
+ QTRY_COMPARE(flm->property("count").toInt(),2); // wait for refresh
+ QCOMPARE(flm->property("folder").toUrl(), QUrl::fromLocalFile(SRCDIR "/data"));
+ QCOMPARE(flm->property("parentFolder").toUrl(), QUrl::fromLocalFile(SRCDIR));
+ QCOMPARE(flm->property("sortField").toInt(), int(Name));
+ QCOMPARE(flm->property("nameFilters").toStringList(), QStringList() << "*.qml");
+ QCOMPARE(flm->property("sortReversed").toBool(), false);
+ QCOMPARE(flm->property("showDirs").toBool(), true);
+ QCOMPARE(flm->property("showDotAndDotDot").toBool(), false);
+ QCOMPARE(flm->property("showOnlyReadable").toBool(), false);
+ QCOMPARE(flm->data(flm->index(0),FileNameRole).toString(), QLatin1String("basic.qml"));
+ QCOMPARE(flm->data(flm->index(1),FileNameRole).toString(), QLatin1String("dummy.qml"));
+}
+
+QTEST_MAIN(tst_qdeclarativefolderlistmodel)
+
+#include "tst_qdeclarativefolderlistmodel.moc"
diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
index e0143a6..720702a 100644
--- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
+++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
@@ -400,7 +400,7 @@ T *tst_qdeclarativeimage::findItem(QGraphicsObject *parent, const QString &objec
//qDebug() << "try" << item;
if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) {
if (index != -1) {
- QDeclarativeExpression e(qmlContext(item), "index", item);
+ QDeclarativeExpression e(qmlContext(item), item, "index");
if (e.evaluate().toInt() == index)
return static_cast<T*>(item);
} else {
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/assignValueToSignal.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/assignValueToSignal.errors.txt
new file mode 100644
index 0000000..eb1430a
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/assignValueToSignal.errors.txt
@@ -0,0 +1 @@
+4:5:Cannot assign a value to a signal (expecting a script to be run)
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/assignValueToSignal.qml
index c84fea3..6fa1259 100644
--- a/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.2.qml
+++ b/tests/auto/declarative/qdeclarativelanguage/data/assignValueToSignal.qml
@@ -1,7 +1,6 @@
import Test 1.0
MyQmlObject {
- onBasicSignal {
- }
+ onBasicSignal: "hello world"
}
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.2.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.2.errors.txt
deleted file mode 100644
index 8b20434..0000000
--- a/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.2.errors.txt
+++ /dev/null
@@ -1 +0,0 @@
-4:5:Incorrectly specified signal assignment
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.errors.txt
index 353bbf5..8b20434 100644
--- a/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.errors.txt
+++ b/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.errors.txt
@@ -1 +1 @@
-4:5:Empty signal assignment
+4:5:Incorrectly specified signal assignment
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.qml b/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.qml
index 4c5a122..c84fea3 100644
--- a/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.qml
+++ b/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.qml
@@ -1,6 +1,7 @@
import Test 1.0
MyQmlObject {
- onBasicSignal: " "
+ onBasicSignal {
+ }
}
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/scriptString2.qml b/tests/auto/declarative/qdeclarativelanguage/data/scriptString2.qml
new file mode 100644
index 0000000..c42da2b
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/scriptString2.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+
+MyTypeObject {
+ scriptProperty: "hello\n\"world\""
+}
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/scriptString3.qml b/tests/auto/declarative/qdeclarativelanguage/data/scriptString3.qml
new file mode 100644
index 0000000..0cd82ff
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/scriptString3.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+
+MyTypeObject {
+ scriptProperty: 12.345
+}
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/scriptString4.qml b/tests/auto/declarative/qdeclarativelanguage/data/scriptString4.qml
new file mode 100644
index 0000000..3e2f9a4
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/scriptString4.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+
+MyTypeObject {
+ scriptProperty: true
+}
diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
index 6b070f5..200f016 100644
--- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
+++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
@@ -351,8 +351,8 @@ void tst_qdeclarativelanguage::errors_data()
QTest::newRow("invalidAttachedProperty.12") << "invalidAttachedProperty.12.qml" << "invalidAttachedProperty.12.errors.txt" << false;
QTest::newRow("invalidAttachedProperty.13") << "invalidAttachedProperty.13.qml" << "invalidAttachedProperty.13.errors.txt" << false;
+ QTest::newRow("assignValueToSignal") << "assignValueToSignal.qml" << "assignValueToSignal.errors.txt" << false;
QTest::newRow("emptySignal") << "emptySignal.qml" << "emptySignal.errors.txt" << false;
- QTest::newRow("emptySignal.2") << "emptySignal.2.qml" << "emptySignal.2.errors.txt" << false;
QTest::newRow("nestedErrors") << "nestedErrors.qml" << "nestedErrors.errors.txt" << false;
QTest::newRow("defaultGrouped") << "defaultGrouped.qml" << "defaultGrouped.errors.txt" << false;
@@ -1105,19 +1105,48 @@ void tst_qdeclarativelanguage::onDestruction()
// Check that assignments to QDeclarativeScriptString properties work
void tst_qdeclarativelanguage::scriptString()
{
- QDeclarativeComponent component(&engine, TEST_FILE("scriptString.qml"));
- VERIFY_ERRORS(0);
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("scriptString.qml"));
+ VERIFY_ERRORS(0);
- MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create());
- QVERIFY(object != 0);
- QCOMPARE(object->scriptProperty().script(), QString("foo + bar"));
- QCOMPARE(object->scriptProperty().scopeObject(), qobject_cast<QObject*>(object));
- QCOMPARE(object->scriptProperty().context(), qmlContext(object));
-
- QVERIFY(object->grouped() != 0);
- QCOMPARE(object->grouped()->script().script(), QString("console.log(1921)"));
- QCOMPARE(object->grouped()->script().scopeObject(), qobject_cast<QObject*>(object));
- QCOMPARE(object->grouped()->script().context(), qmlContext(object));
+ MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->scriptProperty().script(), QString("foo + bar"));
+ QCOMPARE(object->scriptProperty().scopeObject(), qobject_cast<QObject*>(object));
+ QCOMPARE(object->scriptProperty().context(), qmlContext(object));
+
+ QVERIFY(object->grouped() != 0);
+ QCOMPARE(object->grouped()->script().script(), QString("console.log(1921)"));
+ QCOMPARE(object->grouped()->script().scopeObject(), qobject_cast<QObject*>(object));
+ QCOMPARE(object->grouped()->script().context(), qmlContext(object));
+ }
+
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("scriptString2.qml"));
+ VERIFY_ERRORS(0);
+
+ MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->scriptProperty().script(), QString("\"hello\\n\\\"world\\\"\""));
+ }
+
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("scriptString3.qml"));
+ VERIFY_ERRORS(0);
+
+ MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->scriptProperty().script(), QString("12.345"));
+ }
+
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("scriptString4.qml"));
+ VERIFY_ERRORS(0);
+
+ MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->scriptProperty().script(), QString("true"));
+ }
}
// Check that default property assignments are correctly spliced into explicit
diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
index 26a12f0..be4ffe8 100644
--- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
+++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
@@ -275,7 +275,7 @@ void tst_qdeclarativelistmodel::dynamic()
QDeclarativeListModel model;
QDeclarativeEngine::setContextForObject(&model,engine.rootContext());
engine.rootContext()->setContextObject(&model);
- QDeclarativeExpression e(engine.rootContext(), script, &model);
+ QDeclarativeExpression e(engine.rootContext(), &model, script);
if (!warning.isEmpty())
QTest::ignoreMessage(QtWarningMsg, warning.toLatin1());
@@ -332,7 +332,7 @@ void tst_qdeclarativelistmodel::dynamic_worker()
Q_ARG(QVariant, operations.mid(0, operations.length()-1))));
waitForWorker(item);
- QDeclarativeExpression e(eng.rootContext(), operations.last().toString(), &model);
+ QDeclarativeExpression e(eng.rootContext(), &model, operations.last().toString());
if (QByteArray(QTest::currentDataTag()).startsWith("nested"))
QVERIFY(e.evaluate().toInt() != result);
else
diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
index ec2afae..fde2e43 100644
--- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
+++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
@@ -1550,7 +1550,7 @@ T *tst_QDeclarativeListView::findItem(QGraphicsObject *parent, const QString &ob
//qDebug() << "try" << item;
if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) {
if (index != -1) {
- QDeclarativeExpression e(qmlContext(item), "index", item);
+ QDeclarativeExpression e(qmlContext(item), item, "index");
if (e.evaluate().toInt() == index)
return static_cast<T*>(item);
} else {
diff --git a/tests/auto/declarative/qdeclarativeloader/data/AnchoredLoader.qml b/tests/auto/declarative/qdeclarativeloader/data/AnchoredLoader.qml
new file mode 100644
index 0000000..5d02dae
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeloader/data/AnchoredLoader.qml
@@ -0,0 +1,14 @@
+import Qt 4.7
+
+Rectangle {
+ width: 300
+ height: 200
+ color: "blue"
+ Loader {
+ objectName: "loader"
+ anchors.fill: parent
+ sourceComponent: Component {
+ Rectangle { color: "red"; objectName: "sourceElement" }
+ }
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp
index 59580ea..11cc61b 100644
--- a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp
+++ b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp
@@ -78,6 +78,7 @@ private slots:
void clear();
void urlToComponent();
void componentToUrl();
+ void anchoredLoader();
void sizeLoaderToItem();
void sizeItemToLoader();
void noResize();
@@ -266,6 +267,27 @@ void tst_QDeclarativeLoader::componentToUrl()
delete item;
}
+void tst_QDeclarativeLoader::anchoredLoader()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("/AnchoredLoader.qml"));
+ QDeclarativeItem *rootItem = qobject_cast<QDeclarativeItem*>(component.create());
+ QVERIFY(rootItem != 0);
+ QDeclarativeItem *loader = rootItem->findChild<QDeclarativeItem*>("loader");
+ QDeclarativeItem *sourceElement = rootItem->findChild<QDeclarativeItem*>("sourceElement");
+
+ QVERIFY(loader != 0);
+ QVERIFY(sourceElement != 0);
+
+ QCOMPARE(rootItem->width(), 300.0);
+ QCOMPARE(rootItem->height(), 200.0);
+
+ QCOMPARE(loader->width(), 300.0);
+ QCOMPARE(loader->height(), 200.0);
+
+ QCOMPARE(sourceElement->width(), 300.0);
+ QCOMPARE(sourceElement->height(), 200.0);
+}
+
void tst_QDeclarativeLoader::sizeLoaderToItem()
{
QDeclarativeComponent component(&engine, TEST_FILE("/SizeToItem.qml"));
diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp
index 0e16f66..f32a6c7 100644
--- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp
+++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp
@@ -760,7 +760,7 @@ T *tst_QDeclarativePathView::findItem(QGraphicsObject *parent, const QString &ob
//qDebug() << "try" << item;
if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) {
if (index != -1) {
- QDeclarativeExpression e(qmlContext(item), "index", item);
+ QDeclarativeExpression e(qmlContext(item), item, "index");
if (e.evaluate().toInt() == index)
return static_cast<T*>(item);
} else {
diff --git a/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp b/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp
index c238ef9..8f3fb16 100644
--- a/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp
+++ b/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp
@@ -190,7 +190,7 @@ T *tst_qdeclarativevisualdatamodel::findItem(QGraphicsObject *parent, const QStr
//qDebug() << "try" << item;
if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) {
if (index != -1) {
- QDeclarativeExpression e(qmlContext(item), "index", item);
+ QDeclarativeExpression e(qmlContext(item), item, "index");
if (e.evaluate().toInt() == index)
return static_cast<T*>(item);
} else {
diff --git a/tests/auto/declarative/qmlvisual/animation/parentAnimation2/data/parentAnimation2.0.png b/tests/auto/declarative/qmlvisual/animation/parentAnimation2/data/parentAnimation2.0.png
new file mode 100644
index 0000000..135911c
--- /dev/null
+++ b/tests/auto/declarative/qmlvisual/animation/parentAnimation2/data/parentAnimation2.0.png
Binary files differ
diff --git a/tests/auto/declarative/qmlvisual/animation/parentAnimation2/data/parentAnimation2.1.png b/tests/auto/declarative/qmlvisual/animation/parentAnimation2/data/parentAnimation2.1.png
new file mode 100644
index 0000000..0d71292
--- /dev/null
+++ b/tests/auto/declarative/qmlvisual/animation/parentAnimation2/data/parentAnimation2.1.png
Binary files differ
diff --git a/tests/auto/declarative/qmlvisual/animation/parentAnimation2/data/parentAnimation2.2.png b/tests/auto/declarative/qmlvisual/animation/parentAnimation2/data/parentAnimation2.2.png
new file mode 100644
index 0000000..920d992
--- /dev/null
+++ b/tests/auto/declarative/qmlvisual/animation/parentAnimation2/data/parentAnimation2.2.png
Binary files differ
diff --git a/tests/auto/declarative/qmlvisual/animation/parentAnimation2/data/parentAnimation2.3.png b/tests/auto/declarative/qmlvisual/animation/parentAnimation2/data/parentAnimation2.3.png
new file mode 100644
index 0000000..1c4d89e
--- /dev/null
+++ b/tests/auto/declarative/qmlvisual/animation/parentAnimation2/data/parentAnimation2.3.png
Binary files differ
diff --git a/tests/auto/declarative/qmlvisual/animation/parentAnimation2/data/parentAnimation2.qml b/tests/auto/declarative/qmlvisual/animation/parentAnimation2/data/parentAnimation2.qml
new file mode 100644
index 0000000..9e1b923
--- /dev/null
+++ b/tests/auto/declarative/qmlvisual/animation/parentAnimation2/data/parentAnimation2.qml
@@ -0,0 +1,1023 @@
+import Qt.VisualTest 4.7
+
+VisualTest {
+ Frame {
+ msec: 0
+ }
+ Frame {
+ msec: 16
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 32
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 48
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 64
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 80
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 96
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 112
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 128
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 144
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 160
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 176
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 192
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 208
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 224
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 240
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 256
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 272
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 288
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 304
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 320
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 336
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 352
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 368
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 384
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 400
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 416
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 432
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 448
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 464
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 480
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 496
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 512
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 528
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 544
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 560
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 576
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 592
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 608
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 624
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 640
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 656
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 672
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 688
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 704
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Mouse {
+ type: 2
+ button: 1
+ buttons: 1
+ x: 350; y: 182
+ modifiers: 0
+ sendToViewport: true
+ }
+ Frame {
+ msec: 720
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 736
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 752
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 768
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 784
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 800
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Mouse {
+ type: 3
+ button: 1
+ buttons: 0
+ x: 350; y: 182
+ modifiers: 0
+ sendToViewport: true
+ }
+ Frame {
+ msec: 816
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 832
+ hash: "9b524b546d250d239ea99dd3319f3d6a"
+ }
+ Frame {
+ msec: 848
+ hash: "593300f166c2fd3c325cb35114ca595b"
+ }
+ Frame {
+ msec: 864
+ hash: "4451e76e111c99faa77b5fff9a2642fa"
+ }
+ Frame {
+ msec: 880
+ hash: "0b4a5675afba935e17eba19e29b709ee"
+ }
+ Frame {
+ msec: 896
+ hash: "8682866f0234eebf25aca27a7737c777"
+ }
+ Frame {
+ msec: 912
+ hash: "5b3b70dd366bb4c1b5e7d56ce50e59a6"
+ }
+ Frame {
+ msec: 928
+ hash: "897394982c93ebcbea68c25cec6d47d3"
+ }
+ Frame {
+ msec: 944
+ hash: "23c3c0383a517d33767adeebc53bfa3a"
+ }
+ Frame {
+ msec: 960
+ image: "parentAnimation2.0.png"
+ }
+ Frame {
+ msec: 976
+ hash: "95b4fe1e5eeffe1673e199308e8ce76c"
+ }
+ Frame {
+ msec: 992
+ hash: "dbb9a5aa9f569b97711aa2c1f5ebda47"
+ }
+ Frame {
+ msec: 1008
+ hash: "0a5a73409b019e650ea860e1a8e27328"
+ }
+ Frame {
+ msec: 1024
+ hash: "496bd0d053522bcf71d506b497ede0d5"
+ }
+ Frame {
+ msec: 1040
+ hash: "97a32b4a6c99ffe842c35e903bd23d79"
+ }
+ Frame {
+ msec: 1056
+ hash: "496dfbbb0c0c28e108adf4c25341ef11"
+ }
+ Frame {
+ msec: 1072
+ hash: "aa2e5eb88b1498f0d36897be2a36b0ff"
+ }
+ Frame {
+ msec: 1088
+ hash: "0c6f7b54264ab36cfd5145fb7b30432f"
+ }
+ Frame {
+ msec: 1104
+ hash: "797fc3ea1db51f12d900b4e0e4998065"
+ }
+ Frame {
+ msec: 1120
+ hash: "2b076b8bc1ec1e2f21a4d7a77c94cfeb"
+ }
+ Frame {
+ msec: 1136
+ hash: "8d5888ca1cfba19cea569bd38bada417"
+ }
+ Frame {
+ msec: 1152
+ hash: "15ae94de5aa106eaa18d0faefa5d61f5"
+ }
+ Frame {
+ msec: 1168
+ hash: "96e90d74d5a7788d5a6da6cfdb92b185"
+ }
+ Frame {
+ msec: 1184
+ hash: "5698a5e9e628209fc28644198eac65da"
+ }
+ Frame {
+ msec: 1200
+ hash: "074ac8f08de8f22c241e23ad8b89b0f0"
+ }
+ Frame {
+ msec: 1216
+ hash: "a49fdf41e9ee1e5d764262d4585af2ff"
+ }
+ Frame {
+ msec: 1232
+ hash: "accc9b6573a676a40fcf0129085f6fce"
+ }
+ Frame {
+ msec: 1248
+ hash: "1cc956d55f0c382c2f74dcc05a05494f"
+ }
+ Frame {
+ msec: 1264
+ hash: "38ff3121566b2c719f47d027fcef8b8e"
+ }
+ Frame {
+ msec: 1280
+ hash: "4de97b3361a16ca1710f2e75d5c9de6f"
+ }
+ Frame {
+ msec: 1296
+ hash: "dbd1455105630bb8f262140e79ceda1b"
+ }
+ Frame {
+ msec: 1312
+ hash: "bcdac4ab71a29b78bfa756b56b8d8414"
+ }
+ Frame {
+ msec: 1328
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1344
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1360
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1376
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1392
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1408
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1424
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1440
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1456
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1472
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1488
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1504
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1520
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1536
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1552
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1568
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1584
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1600
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1616
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1632
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1648
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1664
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1680
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1696
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1712
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Mouse {
+ type: 2
+ button: 1
+ buttons: 1
+ x: 415; y: 121
+ modifiers: 0
+ sendToViewport: true
+ }
+ Frame {
+ msec: 1728
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1744
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1760
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1776
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1792
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1808
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1824
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Mouse {
+ type: 3
+ button: 1
+ buttons: 0
+ x: 415; y: 121
+ modifiers: 0
+ sendToViewport: true
+ }
+ Frame {
+ msec: 1840
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1856
+ hash: "b59fbcfb7db77cf30ea4ff039a9163ae"
+ }
+ Frame {
+ msec: 1872
+ hash: "432a76f0663bfd35f6bbeb3fbeb91799"
+ }
+ Frame {
+ msec: 1888
+ hash: "098e18005d3a2ff9095587954c92339c"
+ }
+ Frame {
+ msec: 1904
+ hash: "069100bf4ec523a9e9d5bf557ffc51d1"
+ }
+ Frame {
+ msec: 1920
+ image: "parentAnimation2.1.png"
+ }
+ Frame {
+ msec: 1936
+ hash: "60ed700e49bf2c51aba9b44400b56294"
+ }
+ Frame {
+ msec: 1952
+ hash: "79aa15dc74668d963f36f28524f4d091"
+ }
+ Frame {
+ msec: 1968
+ hash: "6838cb2d728259adc8d91a4a69e35adf"
+ }
+ Frame {
+ msec: 1984
+ hash: "3f73c720ce5f1e65fb8537a9beb66d26"
+ }
+ Frame {
+ msec: 2000
+ hash: "95d990ccd3e45e780d875aae1f4654f8"
+ }
+ Frame {
+ msec: 2016
+ hash: "5389a121571f61e73903305860e60016"
+ }
+ Frame {
+ msec: 2032
+ hash: "66f0018b6f35c1c18b28f4959eef96a8"
+ }
+ Frame {
+ msec: 2048
+ hash: "c0fa0560a9a5a0f773394c4fd98c9fa3"
+ }
+ Frame {
+ msec: 2064
+ hash: "e2d665ae0ac3007520003bb4a24ca708"
+ }
+ Frame {
+ msec: 2080
+ hash: "ab6e6976e4214c725f71a4f0ba6d3f68"
+ }
+ Frame {
+ msec: 2096
+ hash: "642f48f731f896d0d4b66956485b615b"
+ }
+ Frame {
+ msec: 2112
+ hash: "cdc36222978e4361dd3ddc2cba78328d"
+ }
+ Frame {
+ msec: 2128
+ hash: "22fe869d83d9d290c4d1702e7553c7aa"
+ }
+ Frame {
+ msec: 2144
+ hash: "3cf2b6a4fd5c73c24717a1ce901cfb19"
+ }
+ Frame {
+ msec: 2160
+ hash: "ea7ecad2a9b7e6ca9a9d1c9c46e0f6dc"
+ }
+ Frame {
+ msec: 2176
+ hash: "3a7e7e2145b40732ef4e18218a959536"
+ }
+ Frame {
+ msec: 2192
+ hash: "1386046373ab246ae533aba206ffe502"
+ }
+ Frame {
+ msec: 2208
+ hash: "2183072e2117c2bc660767bc67e6c355"
+ }
+ Frame {
+ msec: 2224
+ hash: "659c6fedf573d19727f9852a9034e4fe"
+ }
+ Frame {
+ msec: 2240
+ hash: "5be4e8fa87593aeb4d59768a61441c37"
+ }
+ Frame {
+ msec: 2256
+ hash: "2030b883508d07735b20726d218fd751"
+ }
+ Frame {
+ msec: 2272
+ hash: "fd70334fa8a1ff80369cce6aa69255c4"
+ }
+ Frame {
+ msec: 2288
+ hash: "be666aafc8a3d2de9ffaff54d9ac15d1"
+ }
+ Frame {
+ msec: 2304
+ hash: "3370f2246f679068e40cdb48c92decad"
+ }
+ Frame {
+ msec: 2320
+ hash: "f0b4565fd441c071112bdc8225861f76"
+ }
+ Frame {
+ msec: 2336
+ hash: "61babd82afc20a3023c2fe483a2e73cb"
+ }
+ Frame {
+ msec: 2352
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2368
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2384
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2400
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2416
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2432
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2448
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2464
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2480
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2496
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2512
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2528
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2544
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2560
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2576
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2592
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2608
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2624
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2640
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2656
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2672
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2688
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2704
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2720
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2736
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2752
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2768
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Mouse {
+ type: 2
+ button: 1
+ buttons: 1
+ x: 207; y: 255
+ modifiers: 0
+ sendToViewport: true
+ }
+ Frame {
+ msec: 2784
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2800
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2816
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2832
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2848
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2864
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2880
+ image: "parentAnimation2.2.png"
+ }
+ Frame {
+ msec: 2896
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Mouse {
+ type: 3
+ button: 1
+ buttons: 0
+ x: 207; y: 255
+ modifiers: 0
+ sendToViewport: true
+ }
+ Frame {
+ msec: 2912
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2928
+ hash: "608af88c841d6058c3304cc134de0187"
+ }
+ Frame {
+ msec: 2944
+ hash: "96a727d6ff02c7baf85865fda9d871bd"
+ }
+ Frame {
+ msec: 2960
+ hash: "22cacf109e40b457041d6c2862c4f97f"
+ }
+ Frame {
+ msec: 2976
+ hash: "ea2a53381eef8ac75fce23c518f1e261"
+ }
+ Frame {
+ msec: 2992
+ hash: "a719237e74e9c40b46cc1f27cca5e286"
+ }
+ Frame {
+ msec: 3008
+ hash: "804ef3519ba9852afb0bd4ef793e0006"
+ }
+ Frame {
+ msec: 3024
+ hash: "4abc5026f0de1165717bd14630c9d9f6"
+ }
+ Frame {
+ msec: 3040
+ hash: "1e4dd04698691932725076073a0bd2e7"
+ }
+ Frame {
+ msec: 3056
+ hash: "12aae9dcfd9597ce600588b19bdf5a7d"
+ }
+ Frame {
+ msec: 3072
+ hash: "9176b69f7df68d860b7d7aecc2496f09"
+ }
+ Frame {
+ msec: 3088
+ hash: "9cba95a510685ab6367ba87246f6c922"
+ }
+ Frame {
+ msec: 3104
+ hash: "33ef448b9485fafb7a2af319f9f6e816"
+ }
+ Frame {
+ msec: 3120
+ hash: "791760db748e46aceb9f469c33b7bf2f"
+ }
+ Frame {
+ msec: 3136
+ hash: "201a00feef1bb445f2fd0ba8ef9467a1"
+ }
+ Frame {
+ msec: 3152
+ hash: "6e8962c3cb522f5a45b093f1780d2dae"
+ }
+ Frame {
+ msec: 3168
+ hash: "d75cb08203a4f2c05b4dfdca2196e3db"
+ }
+ Frame {
+ msec: 3184
+ hash: "0417d681c9b64e2cc252ab6fcf20148b"
+ }
+ Frame {
+ msec: 3200
+ hash: "85993e5a91a86cedb8c88819b035b6bb"
+ }
+ Frame {
+ msec: 3216
+ hash: "d7a0db647e641df9625b8eb5078a8ec3"
+ }
+ Frame {
+ msec: 3232
+ hash: "fa29824ed3fd3d4e0d8036079be6bcf8"
+ }
+ Frame {
+ msec: 3248
+ hash: "4fc84a3ae74bb6ab7b0b846c8747eb54"
+ }
+ Frame {
+ msec: 3264
+ hash: "a172921ffe15077382db8e8915fb340b"
+ }
+ Frame {
+ msec: 3280
+ hash: "480ee71d2407d729814a2e19d4320c59"
+ }
+ Frame {
+ msec: 3296
+ hash: "b8cf02a1ad96d5c3354f2b658085ed28"
+ }
+ Frame {
+ msec: 3312
+ hash: "80fc0f57f58250f63a77b1988a9e1d2e"
+ }
+ Frame {
+ msec: 3328
+ hash: "bc283b5d7c5b88ef447be5992a77b6a9"
+ }
+ Frame {
+ msec: 3344
+ hash: "89c86df88dc1a3188d52c1f75b80ccf1"
+ }
+ Frame {
+ msec: 3360
+ hash: "84148139d89b45949561321bd6f6c835"
+ }
+ Frame {
+ msec: 3376
+ hash: "9118d6933b3f77e0b5b8da2d630152e8"
+ }
+ Frame {
+ msec: 3392
+ hash: "2b5f746225053778fb07a606ff113e64"
+ }
+ Frame {
+ msec: 3408
+ hash: "0a1ed1bea6ed674826d0a2c3146a1c31"
+ }
+ Frame {
+ msec: 3424
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3440
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3456
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3472
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3488
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3504
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3520
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3536
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3552
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3568
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3584
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3600
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3616
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3632
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3648
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Key {
+ type: 6
+ key: 16777249
+ modifiers: 67108864
+ text: ""
+ autorep: false
+ count: 1
+ }
+ Frame {
+ msec: 3664
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3680
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3696
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3712
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3728
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3744
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3760
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3776
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3792
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3808
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3824
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3840
+ image: "parentAnimation2.3.png"
+ }
+}
diff --git a/tests/auto/declarative/qmlvisual/animation/parentAnimation2/parentAnimation2.qml b/tests/auto/declarative/qmlvisual/animation/parentAnimation2/parentAnimation2.qml
new file mode 100644
index 0000000..dfab108
--- /dev/null
+++ b/tests/auto/declarative/qmlvisual/animation/parentAnimation2/parentAnimation2.qml
@@ -0,0 +1,64 @@
+import Qt 4.7
+
+/*
+Blue rect fills (with 10px margin) screen, then red, then green, then screen again.
+*/
+
+Rectangle {
+ id: whiteRect
+ width: 640; height: 480;
+
+ Rectangle {
+ id: redRect
+ x: 400; y: 50
+ width: 100; height: 100
+ color: "red"
+ }
+
+ Rectangle {
+ id: greenRect
+ x: 100; y: 150
+ width: 200; height: 300
+ color: "green"
+ }
+
+ Rectangle {
+ id: blueRect
+ x: 5; y: 5
+ width: parent.width-10
+ height: parent.height-10
+ color: "lightblue"
+
+ //Text { text: "Click me!"; anchors.centerIn: parent }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ switch(blueRect.state) {
+ case "": blueRect.state = "inRed"; break;
+ case "inRed": blueRect.state = "inGreen"; break;
+ case "inGreen": blueRect.state = ""; break;
+ }
+ }
+ }
+
+ states: [
+ State {
+ name: "inRed"
+ ParentChange { target: blueRect; parent: redRect; x: 5; y: 5; width: parent.width-10; height: parent.height-10 }
+ PropertyChanges { target: redRect; z: 1 }
+ },
+ State {
+ name: "inGreen"
+ ParentChange { target: blueRect; parent: greenRect; x: 5; y: 5; width: parent.width-10; height: parent.height-10 }
+ PropertyChanges { target: greenRect; z: 1 }
+ }
+ ]
+
+ transitions: Transition {
+ ParentAnimation { target: blueRect; //via: whiteRect;
+ NumberAnimation { properties: "x, y, width, height"; duration: 500 }
+ }
+ }
+ }
+}
diff --git a/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp b/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp
index 4aad29b..f105692 100644
--- a/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp
+++ b/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp
@@ -105,6 +105,7 @@ void tst_qmlvisual::visual_data()
files << QT_TEST_SOURCE_DIR "/qdeclarativeborderimage/animated.qml";
files << QT_TEST_SOURCE_DIR "/qdeclarativeflipable/test-flipable.qml";
files << QT_TEST_SOURCE_DIR "/qdeclarativepositioners/usingRepeater.qml";
+ files << QT_TEST_SOURCE_DIR "/animation/parentAnimation2/parentAnimation2.qml";
//these are tests we think are stable and useful enough to be run by the CI system
files << QT_TEST_SOURCE_DIR "/animation/bindinganimation/bindinganimation.qml";
diff --git a/tools/qml/content/Browser.qml b/tools/qml/content/Browser.qml
index c3a2cc0..fe7ad9c 100644
--- a/tools/qml/content/Browser.qml
+++ b/tools/qml/content/Browser.qml
@@ -1,4 +1,5 @@
import Qt 4.7
+import Qt.labs.folderlistmodel 1.0
Rectangle {
id: root
diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp
index 380f5cc..18e2531 100644
--- a/tools/qml/main.cpp
+++ b/tools/qml/main.cpp
@@ -50,7 +50,6 @@
#include <QDebug>
#include <QMessageBox>
#include "qdeclarativetester.h"
-#include "qdeclarativefolderlistmodel.h"
QT_USE_NAMESPACE
@@ -181,7 +180,7 @@ int main(int argc, char ** argv)
atexit(showWarnings);
#endif
-#if defined (Q_WS_X11)
+#if defined (Q_WS_X11) || defined (Q_WS_MAC)
//### default to using raster graphics backend for now
bool gsSpecified = false;
for (int i = 0; i < argc; ++i) {
@@ -203,7 +202,6 @@ int main(int argc, char ** argv)
QDeclarativeViewer::registerTypes();
QDeclarativeTester::registerTypes();
- QDeclarativeFolderListModel::registerTypes();
bool frameless = false;
QString fileName;
@@ -236,6 +234,10 @@ int main(int argc, char ** argv)
useNativeFileBrowser = false;
#endif
+#if defined(Q_WS_MAC)
+ useGL = true;
+#endif
+
for (int i = 1; i < argc; ++i) {
bool lastArg = (i == argc - 1);
QString arg = argv[i];
diff --git a/tools/qml/qml.pri b/tools/qml/qml.pri
index a2058c7..5e3e74b 100644
--- a/tools/qml/qml.pri
+++ b/tools/qml/qml.pri
@@ -10,12 +10,10 @@ HEADERS += $$PWD/qmlruntime.h \
$$PWD/proxysettings.h \
$$PWD/qdeclarativetester.h \
$$PWD/deviceorientation.h \
- $$PWD/qdeclarativefolderlistmodel.h \
$$PWD/loggerwidget.h
SOURCES += $$PWD/qmlruntime.cpp \
$$PWD/proxysettings.cpp \
$$PWD/qdeclarativetester.cpp \
- $$PWD/qdeclarativefolderlistmodel.cpp \
$$PWD/loggerwidget.cpp
RESOURCES = $$PWD/qmlruntime.qrc
diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp
index 9700090..490fa34 100644
--- a/tools/qml/qmlruntime.cpp
+++ b/tools/qml/qmlruntime.cpp
@@ -906,6 +906,7 @@ bool QDeclarativeViewer::open(const QString& file_or_url)
QString fileName = url.toLocalFile();
if (!fileName.isEmpty()) {
+ fi.setFile(fileName);
if (fi.exists()) {
if (fi.suffix().toLower() != QLatin1String("qml")) {
qWarning() << "qml cannot open non-QML file" << fileName;