summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-09-01 05:13:23 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-09-01 05:13:23 (GMT)
commit9dd08623cbf15a7f3c36adab613a659be65ee489 (patch)
tree0b4ca7906a6c95bcdde506a8e77b305b9693ef50
parent7b6028276cf5de1ffd5ab8d6dede7cca12e906fd (diff)
parentc8c8fd92baee91d3079e9696c3c05d0fa455f7ab (diff)
downloadQt-9dd08623cbf15a7f3c36adab613a659be65ee489.zip
Qt-9dd08623cbf15a7f3c36adab613a659be65ee489.tar.gz
Qt-9dd08623cbf15a7f3c36adab613a659be65ee489.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: Flickable ensure internal pressed state is cleared when mouse is released. Fix examples autotest Support JS "in" operator on QML objects Only emit change signal when variant properties actually change Use QApplication in QDeclarativeEngine example.
-rw-r--r--doc/src/declarative/qml-intro.qdoc7
-rw-r--r--doc/src/declarative/qmlruntime.qdoc12
-rw-r--r--doc/src/snippets/declarative/qml-intro/basic-syntax.qml48
-rw-r--r--doc/src/snippets/declarative/qml-intro/sequential-animation3.qml2
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflickable.cpp1
-rw-r--r--src/declarative/qml/qdeclarativeobjectscriptclass.cpp2
-rw-r--r--src/declarative/qml/qdeclarativevmemetaobject.cpp14
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/in.qml7
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp11
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/variantNotify.qml13
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp16
11 files changed, 74 insertions, 59 deletions
diff --git a/doc/src/declarative/qml-intro.qdoc b/doc/src/declarative/qml-intro.qdoc
index 63d6825..9130be0 100644
--- a/doc/src/declarative/qml-intro.qdoc
+++ b/doc/src/declarative/qml-intro.qdoc
@@ -58,7 +58,12 @@ would be a property.
The basic syntax of an \l{QML Elements}{element} is
-\snippet doc/src/snippets/declarative/qml-intro/basic-syntax.qml basic syntax
+\code
+SomeElement {
+ id: myObject
+ ... some other things here ...
+}
+\endcode
Here we are defining a new object. We specify its 'type' first as SomeElement.
Then within matching braces { ... } we specify the various parts of our
diff --git a/doc/src/declarative/qmlruntime.qdoc b/doc/src/declarative/qmlruntime.qdoc
index d44e774..9a84237 100644
--- a/doc/src/declarative/qmlruntime.qdoc
+++ b/doc/src/declarative/qmlruntime.qdoc
@@ -104,20 +104,22 @@ can be constructed directly instead. In this case, \c application.qml is
loaded as a QDeclarativeComponent instance rather than placed into a view:
\code
- #include <QCoreApplication>
+ #include <QApplication>
#include <QDeclarativeEngine>
+ #include <QDeclarativeContext>
+ #include <QDeclarativeComponent>
int main(int argc, char *argv[])
{
- QCoreApplication app(argc, argv);
+ QApplication app(argc, argv);
QDeclarativeEngine engine;
- QDeclarativeContext *windowContext = new QDeclarativeContext(engine.rootContext());
+ QDeclarativeContext *objectContext = new QDeclarativeContext(engine.rootContext());
QDeclarativeComponent component(&engine, "application.qml");
- QObject *window = component.create(windowContext);
+ QObject *object = component.create(objectContext);
- // ... delete window and windowContext when necessary
+ // ... delete object and objectContext when necessary
return app.exec();
}
diff --git a/doc/src/snippets/declarative/qml-intro/basic-syntax.qml b/doc/src/snippets/declarative/qml-intro/basic-syntax.qml
deleted file mode 100644
index 686a927..0000000
--- a/doc/src/snippets/declarative/qml-intro/basic-syntax.qml
+++ /dev/null
@@ -1,48 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// Note: this file is not intended to be run.
-
-//! [basic syntax]
-SomeElement {
- id: myObject
- ... some other things here ...
-}
-//! [basic syntax]
diff --git a/doc/src/snippets/declarative/qml-intro/sequential-animation3.qml b/doc/src/snippets/declarative/qml-intro/sequential-animation3.qml
index f83a966..6926f8a 100644
--- a/doc/src/snippets/declarative/qml-intro/sequential-animation3.qml
+++ b/doc/src/snippets/declarative/qml-intro/sequential-animation3.qml
@@ -39,6 +39,8 @@
****************************************************************************/
//! [document]
+import Qt 4.7
+
Rectangle {
id: mainRec
width: 600
diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp
index 63a2a77..b302393 100644
--- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp
@@ -1258,6 +1258,7 @@ bool QDeclarativeFlickable::sendMouseEvent(QGraphicsSceneMouseEvent *event)
if (mouseEvent.type() == QEvent::GraphicsSceneMouseRelease) {
d->clearDelayedPress();
d->stealMouse = false;
+ d->pressed = false;
}
return false;
}
diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
index 3af892d..f439151 100644
--- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
+++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
@@ -192,7 +192,7 @@ QDeclarativeObjectScriptClass::queryProperty(QObject *obj, const Identifier &nam
if (!(hints & ImplicitObject)) {
local.coreIndex = -1;
lastData = &local;
- return QScriptClass::HandlesReadAccess | QScriptClass::HandlesWriteAccess;
+ return QScriptClass::HandlesWriteAccess;
}
return 0;
diff --git a/src/declarative/qml/qdeclarativevmemetaobject.cpp b/src/declarative/qml/qdeclarativevmemetaobject.cpp
index 689ed92..3e32006 100644
--- a/src/declarative/qml/qdeclarativevmemetaobject.cpp
+++ b/src/declarative/qml/qdeclarativevmemetaobject.cpp
@@ -707,11 +707,19 @@ void QDeclarativeVMEMetaObject::writeVarProperty(int id, const QScriptValue &val
void QDeclarativeVMEMetaObject::writeVarProperty(int id, const QVariant &value)
{
- if (value.userType() == QMetaType::QObjectStar)
+ bool needActivate = false;
+ if (value.userType() == QMetaType::QObjectStar) {
+ QObject *o = qvariant_cast<QObject *>(value);
+ needActivate = (data[id].dataType() != QMetaType::QObjectStar || data[id].asQObject() != o);
data[id].setValue(qvariant_cast<QObject *>(value));
- else
+ } else {
+ needActivate = (data[id].dataType() != qMetaTypeId<QVariant>() ||
+ data[id].asQVariant().userType() != value.userType() ||
+ data[id].asQVariant() != value);
data[id].setValue(value);
- activate(object, methodOffset + id, 0);
+ }
+ if (needActivate)
+ activate(object, methodOffset + id, 0);
}
void QDeclarativeVMEMetaObject::listChanged(int id)
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/in.qml b/tests/auto/declarative/qdeclarativeecmascript/data/in.qml
new file mode 100644
index 0000000..0b5b0ba
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/in.qml
@@ -0,0 +1,7 @@
+import Qt 4.7
+
+Item {
+ id: root
+ property bool test1: "x" in root
+ property bool test2: !("foo" in root)
+}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
index 496cc05..76ca964 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
+++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
@@ -159,6 +159,7 @@ private slots:
void qtbug_11600();
void nonscriptable();
void deleteLater();
+ void in();
void include();
@@ -2553,6 +2554,16 @@ void tst_qdeclarativeecmascript::deleteLater()
delete o;
}
+void tst_qdeclarativeecmascript::in()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("in.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ QCOMPARE(o->property("test1").toBool(), true);
+ QCOMPARE(o->property("test2").toBool(), true);
+ delete o;
+}
+
QTEST_MAIN(tst_qdeclarativeecmascript)
#include "tst_qdeclarativeecmascript.moc"
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/variantNotify.qml b/tests/auto/declarative/qdeclarativelanguage/data/variantNotify.qml
new file mode 100644
index 0000000..e7aaf16
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/variantNotify.qml
@@ -0,0 +1,13 @@
+import Qt 4.7
+
+QtObject {
+ property int notifyCount: 0
+
+ property variant foo
+ onFooChanged: notifyCount++
+
+ Component.onCompleted: {
+ foo = 1;
+ foo = 1;
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
index fc78663..dc00e16 100644
--- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
+++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
@@ -142,8 +142,8 @@ private slots:
void importsOrder();
void qmlAttachedPropertiesObjectMethod();
-
void customOnProperty();
+ void variantNotify();
// regression tests for crashes
void crash1();
@@ -1685,6 +1685,20 @@ void tst_qdeclarativelanguage::customOnProperty()
delete object;
}
+// QTBUG-12601
+void tst_qdeclarativelanguage::variantNotify()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("variantNotify.qml"));
+
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("notifyCount").toInt(), 1);
+
+ delete object;
+}
+
void tst_qdeclarativelanguage::initTestCase()
{
registerTypes();