aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2016-01-29 13:01:21 +0100
committerLiang Qi <liang.qi@theqtcompany.com>2016-01-29 13:01:22 +0100
commit1e421097f08876f5e2242be6f7a20db2aeb51692 (patch)
treec45b9323368cfdede67facd43c076a85322f12f6
parentf4788a13e98aa4e5438327094524d7b8239893ec (diff)
parent666bc731a0ba930ca0cfda18daf836913fd91361 (diff)
Merge remote-tracking branch 'origin/5.6' into dev
-rw-r--r--examples/quick/demos/photosurface/doc/src/photosurface.qdoc6
-rw-r--r--examples/quick/demos/photosurface/main.cpp66
-rw-r--r--examples/quick/demos/photosurface/photosurface.qml21
-rw-r--r--examples/quick/demos/stocqt/content/+windows/Settings.qml46
-rw-r--r--examples/quick/demos/stocqt/content/Button.qml3
-rw-r--r--examples/quick/demos/stocqt/content/Settings.qml46
-rw-r--r--examples/quick/demos/stocqt/content/StockChart.qml5
-rw-r--r--examples/quick/demos/stocqt/content/StockInfo.qml11
-rw-r--r--examples/quick/demos/stocqt/content/StockListView.qml11
-rw-r--r--examples/quick/demos/stocqt/content/StockSettingsPanel.qml9
-rw-r--r--examples/quick/demos/stocqt/content/qmldir10
-rw-r--r--examples/quick/demos/stocqt/stocqt.qrc3
-rw-r--r--src/qml/compiler/qqmlirbuilder.cpp12
-rw-r--r--src/qml/compiler/qqmlirbuilder_p.h9
-rw-r--r--src/qml/compiler/qqmltypecompiler.cpp5
-rw-r--r--src/qml/jsruntime/qv4include.cpp2
-rw-r--r--src/qml/jsruntime/qv4persistent.cpp21
-rw-r--r--src/qml/jsruntime/qv4persistent_p.h8
-rw-r--r--src/qml/memory/qv4mm.cpp17
-rw-r--r--src/qml/memory/qv4mm_p.h2
-rw-r--r--src/qml/qml/qqmlmetatype.cpp2
-rw-r--r--src/qml/qml/qqmlvaluetypewrapper.cpp10
-rw-r--r--src/qml/types/qqmllistmodel.cpp3
-rw-r--r--src/quick/doc/src/concepts/statesanimations/states.qdoc2
-rw-r--r--src/quick/items/qquickanimatedsprite_p.h4
-rw-r--r--src/quick/items/qquickdroparea.cpp2
-rw-r--r--src/quick/items/qquickitem.cpp4
-rw-r--r--src/quick/items/qquickpathview.cpp4
-rw-r--r--src/quick/items/qquicktext.cpp4
-rw-r--r--src/quick/items/qquicktext_p.h2
-rw-r--r--src/quick/items/qquicktextnode.cpp118
-rw-r--r--src/quick/items/qquickwindow.cpp19
-rw-r--r--src/quick/items/qquickwindow.h2
-rw-r--r--src/quick/items/qquickwindow_p.h1
-rw-r--r--tests/auto/qml/qqmlecmascript/data/metaobjectRevision5.qml12
-rw-r--r--tests/auto/qml/qqmlecmascript/testtypes.cpp1
-rw-r--r--tests/auto/qml/qqmlecmascript/testtypes.h17
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp9
-rw-r--r--tests/auto/qml/qqmlengine/data/interception/includes/Intercepted.qml5
-rw-r--r--tests/auto/qml/qqmlengine/data/interception/includes/intercepted.js3
-rw-r--r--tests/auto/qml/qqmlengine/data/interception/includes/intercepted/included.js3
-rw-r--r--tests/auto/qml/qqmlengine/data/interception/includes/intercepted/intercepted.js3
-rw-r--r--tests/auto/qml/qqmlengine/data/interception/includes/intercepted/intercepted/included.js3
-rw-r--r--tests/auto/qml/qqmlengine/data/interception/includes/urlInterceptor.qml11
-rw-r--r--tests/auto/qml/qqmlengine/tst_qqmlengine.cpp9
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp20
-rw-r--r--tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp18
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp342
-rw-r--r--tools/qmlimportscanner/main.cpp31
49 files changed, 562 insertions, 415 deletions
diff --git a/examples/quick/demos/photosurface/doc/src/photosurface.qdoc b/examples/quick/demos/photosurface/doc/src/photosurface.qdoc
index 52466843b4..a032d730eb 100644
--- a/examples/quick/demos/photosurface/doc/src/photosurface.qdoc
+++ b/examples/quick/demos/photosurface/doc/src/photosurface.qdoc
@@ -116,6 +116,7 @@
\quotefromfile demos/photosurface/photosurface.qml
\skipto Rectangle
+ \printuntil Component.onCompleted
\printuntil }
\section1 Handling Pinch Gestures
@@ -123,6 +124,7 @@
We use a PinchArea that contains a MouseArea in the photo frames to handle
dragging, rotation and pinch zooming of the frame:
+ \skipto PinchArea
\printuntil onPinchStarted
We use the \c pinch group property to control how the photo frames react to
@@ -137,13 +139,13 @@
frame is controlled in the \c onEntered signal handler to highlight the
selected image:
+ \skipto MouseArea
\printuntil onEntered
To enable you to test the example on the desktop, we use the MouseArea's
\c onWheel signal handler to simulate pinch gestures by using a mouse:
- \printuntil photoFrame.y
- \printuntil }
+ \printuntil photoFrame.scale
\printuntil }
\printuntil }
diff --git a/examples/quick/demos/photosurface/main.cpp b/examples/quick/demos/photosurface/main.cpp
index 3058238494..9456694032 100644
--- a/examples/quick/demos/photosurface/main.cpp
+++ b/examples/quick/demos/photosurface/main.cpp
@@ -44,9 +44,28 @@
#include <QtGui/QGuiApplication>
#endif
#include <QtQml/QQmlApplicationEngine>
+#include <QtQml/QQmlContext>
#include <QtQuick/QQuickWindow>
+#include <QtGui/QImageReader>
+#include <QtCore/QCommandLineParser>
+#include <QtCore/QCommandLineOption>
+#include <QtCore/QDebug>
+#include <QtCore/QDir>
+#include <QtCore/QMimeDatabase>
+#include <QtCore/QStandardPaths>
#include <QtCore/QUrl>
+static QStringList imageNameFilters()
+{
+ QStringList result;
+ QMimeDatabase mimeDatabase;
+ foreach (const QByteArray &m, QImageReader::supportedMimeTypes()) {
+ foreach (const QString &suffix, mimeDatabase.mimeTypeForName(m).suffixes())
+ result.append(QStringLiteral("*.") + suffix);
+ }
+ return result;
+}
+
int main(int argc, char* argv[])
{
// The reason to use QApplication is that QWidget-based dialogs
@@ -58,6 +77,51 @@ int main(int argc, char* argv[])
QGuiApplication app(argc, argv);
#endif
QQuickWindow::setDefaultAlphaBuffer(true);
- QQmlApplicationEngine engine(QUrl("qrc:///photosurface.qml"));
+
+ QCoreApplication::setApplicationName(QStringLiteral("Photosurface"));
+ QCoreApplication::setOrganizationName(QStringLiteral("QtProject"));
+ QCoreApplication::setApplicationVersion(QLatin1String(QT_VERSION_STR));
+ QCommandLineParser parser;
+ parser.setApplicationDescription(QStringLiteral("Qt Quick Demo - Photo Surface"));
+ parser.addHelpOption();
+ parser.addVersionOption();
+ parser.addPositionalArgument(QStringLiteral("directory"),
+ QStringLiteral("The image directory or URL to show."));
+ parser.process(app);
+
+ QUrl initialUrl;
+ if (!parser.positionalArguments().isEmpty()) {
+ initialUrl = QUrl::fromUserInput(parser.positionalArguments().first(),
+ QDir::currentPath(), QUrl::AssumeLocalFile);
+ if (!initialUrl.isValid()) {
+ qWarning().nospace() << "Invalid argument: \""
+ << parser.positionalArguments().first() << "\": " << initialUrl.errorString();
+ return 1;
+ }
+ }
+
+ const QStringList nameFilters = imageNameFilters();
+
+ QQmlApplicationEngine engine;
+ QQmlContext *context = engine.rootContext();
+
+ QUrl picturesLocationUrl = QUrl::fromLocalFile(QDir::homePath());
+ const QStringList picturesLocations = QStandardPaths::standardLocations(QStandardPaths::PicturesLocation);
+ if (!picturesLocations.isEmpty()) {
+ picturesLocationUrl = QUrl::fromLocalFile(picturesLocations.first());
+ if (initialUrl.isEmpty()
+ && !QDir(picturesLocations.first()).entryInfoList(nameFilters, QDir::Files).isEmpty()) {
+ initialUrl = picturesLocationUrl;
+ }
+ }
+
+ context->setContextProperty(QStringLiteral("contextPicturesLocation"), picturesLocationUrl);
+ context->setContextProperty(QStringLiteral("contextInitialUrl"), initialUrl);
+ context->setContextProperty(QStringLiteral("contextImageNameFilters"), nameFilters);
+
+ engine.load(QUrl("qrc:///photosurface.qml"));
+ if (engine.rootObjects().isEmpty())
+ return -1;
+
return app.exec();
}
diff --git a/examples/quick/demos/photosurface/photosurface.qml b/examples/quick/demos/photosurface/photosurface.qml
index 22cef62157..d8a424e8f8 100644
--- a/examples/quick/demos/photosurface/photosurface.qml
+++ b/examples/quick/demos/photosurface/photosurface.qml
@@ -56,6 +56,7 @@ Window {
id: fileDialog
title: "Choose a folder with some images"
selectFolder: true
+ folder: picturesLocation
onAccepted: folderModel.folder = fileUrl + "/"
}
@@ -69,7 +70,7 @@ Window {
id: folderModel
objectName: "folderModel"
showDirs: false
- nameFilters: ["*.png", "*.jpg", "*.gif"]
+ nameFilters: imageNameFilters
}
Rectangle {
id: photoFrame
@@ -255,5 +256,21 @@ Window {
Shortcut { sequence: StandardKey.Quit; onActivated: Qt.quit() }
- Component.onCompleted: fileDialog.open()
+ Component.onCompleted: {
+ if (typeof contextInitialUrl !== 'undefined') {
+ // Launched from C++ with context properties set.
+ imageNameFilters = contextImageNameFilters;
+ picturesLocation = contextPicturesLocation;
+ if (contextInitialUrl == "")
+ fileDialog.open();
+ else
+ folderModel.folder = contextInitialUrl + "/";
+ } else {
+ // Launched via QML viewer without context properties set.
+ fileDialog.open();
+ }
+ }
+
+ property var imageNameFilters : ["*.png", "*.jpg", "*.gif"];
+ property string picturesLocation : "";
}
diff --git a/examples/quick/demos/stocqt/content/+windows/Settings.qml b/examples/quick/demos/stocqt/content/+windows/Settings.qml
new file mode 100644
index 0000000000..1d4d7edcee
--- /dev/null
+++ b/examples/quick/demos/stocqt/content/+windows/Settings.qml
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples 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 The Qt Company Ltd 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$
+**
+****************************************************************************/
+
+pragma Singleton
+import QtQml 2.0
+
+QtObject {
+ property string fontFamily: "Arial"
+}
diff --git a/examples/quick/demos/stocqt/content/Button.qml b/examples/quick/demos/stocqt/content/Button.qml
index e85a5d41c5..4ef86a2cc3 100644
--- a/examples/quick/demos/stocqt/content/Button.qml
+++ b/examples/quick/demos/stocqt/content/Button.qml
@@ -39,6 +39,7 @@
****************************************************************************/
import QtQuick 2.0
+import "."
Rectangle {
id: button
@@ -54,7 +55,7 @@ Rectangle {
}
Text {
anchors.centerIn: parent
- font.family: "Open Sans"
+ font.family: Settings.fontFamily
font.pointSize: 19
font.weight: Font.DemiBold
color: button.buttonEnabled ? "#000000" : "#14aaff"
diff --git a/examples/quick/demos/stocqt/content/Settings.qml b/examples/quick/demos/stocqt/content/Settings.qml
new file mode 100644
index 0000000000..39e1c4c241
--- /dev/null
+++ b/examples/quick/demos/stocqt/content/Settings.qml
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples 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 The Qt Company Ltd 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$
+**
+****************************************************************************/
+
+pragma Singleton
+import QtQml 2.0
+
+QtObject {
+ property string fontFamily: "Open Sans"
+}
diff --git a/examples/quick/demos/stocqt/content/StockChart.qml b/examples/quick/demos/stocqt/content/StockChart.qml
index bbe5b77d0c..147f513456 100644
--- a/examples/quick/demos/stocqt/content/StockChart.qml
+++ b/examples/quick/demos/stocqt/content/StockChart.qml
@@ -39,6 +39,7 @@
****************************************************************************/
import QtQuick 2.0
+import "."
Rectangle {
id: chart
@@ -135,7 +136,7 @@ Rectangle {
Text {
id: fromDate
color: "#000000"
- font.family: "Open Sans"
+ font.family: Settings.fontFamily
font.pointSize: 8
anchors.left: parent.left
anchors.bottom: parent.bottom
@@ -145,7 +146,7 @@ Rectangle {
Text {
id: toDate
color: "#000000"
- font.family: "Open Sans"
+ font.family: Settings.fontFamily
font.pointSize: 8
anchors.right: parent.right
anchors.rightMargin: canvas.tickMargin
diff --git a/examples/quick/demos/stocqt/content/StockInfo.qml b/examples/quick/demos/stocqt/content/StockInfo.qml
index 50f6b9107e..3c5ee196f2 100644
--- a/examples/quick/demos/stocqt/content/StockInfo.qml
+++ b/examples/quick/demos/stocqt/content/StockInfo.qml
@@ -39,6 +39,7 @@
****************************************************************************/
import QtQuick 2.0
+import "."
Rectangle {
id: root
@@ -60,7 +61,7 @@ Rectangle {
Text {
id: stockIdText
color: "#000000"
- font.family: "Open Sans"
+ font.family: Settings.fontFamily
font.pointSize: 28
font.weight: Font.DemiBold
text: root.stock.stockId
@@ -69,7 +70,7 @@ Rectangle {
Text {
id: price
color: "#6d6d6d"
- font.family: "Open Sans"
+ font.family: Settings.fontFamily
font.pointSize: 28
font.weight: Font.DemiBold
text: parseFloat(Math.round(root.stock.stockPrice * 100) / 100).toFixed(2);
@@ -79,7 +80,7 @@ Rectangle {
Text {
id: stockNameText
color: "#0c0c0c"
- font.family: "Open Sans"
+ font.family: Settings.fontFamily
font.pointSize: 16
width: stockColumn.width
elide: Text.ElideRight
@@ -96,7 +97,7 @@ Rectangle {
id: priceChange
horizontalAlignment: Text.AlignRight
color: root.stock.stockPriceChanged < 0 ? "#d40000" : "#328930"
- font.family: "Open Sans"
+ font.family: Settings.fontFamily
font.pointSize: 18
text: parseFloat(Math.round(root.stock.stockPriceChanged * 100) / 100).toFixed(2);
}
@@ -105,7 +106,7 @@ Rectangle {
id: priceChangePercentage
horizontalAlignment: Text.AlignRight
color: root.stock.stockPriceChanged < 0 ? "#d40000" : "#328930"
- font.family: "Open Sans"
+ font.family: Settings.fontFamily
font.pointSize: 18
font.weight: Font.DemiBold
text: "(" +
diff --git a/examples/quick/demos/stocqt/content/StockListView.qml b/examples/quick/demos/stocqt/content/StockListView.qml
index 470531a21e..d1f735fde3 100644
--- a/examples/quick/demos/stocqt/content/StockListView.qml
+++ b/examples/quick/demos/stocqt/content/StockListView.qml
@@ -39,6 +39,7 @@
****************************************************************************/
import QtQuick 2.0
+import "."
Rectangle {
id: root
@@ -144,7 +145,7 @@ Rectangle {
width: 125
height: 40
color: "#000000"
- font.family: "Open Sans"
+ font.family: Settings.fontFamily
font.pointSize: 20
font.weight: Font.Bold
verticalAlignment: Text.AlignVCenter
@@ -160,7 +161,7 @@ Rectangle {
width: 190
height: 40
color: "#000000"
- font.family: "Open Sans"
+ font.family: Settings.fontFamily
font.pointSize: 20
font.bold: true
horizontalAlignment: Text.AlignRight
@@ -178,7 +179,7 @@ Rectangle {
width: 135
height: 40
color: "#328930"
- font.family: "Open Sans"
+ font.family: Settings.fontFamily
font.pointSize: 20
font.bold: true
horizontalAlignment: Text.AlignRight
@@ -200,7 +201,7 @@ Rectangle {
width: 330
height: 30
color: "#000000"
- font.family: "Open Sans"
+ font.family: Settings.fontFamily
font.pointSize: 16
font.bold: false
elide: Text.ElideRight
@@ -217,7 +218,7 @@ Rectangle {
width: 120
height: 30
color: "#328930"
- font.family: "Open Sans"
+ font.family: Settings.fontFamily
font.pointSize: 18
font.bold: false
horizontalAlignment: Text.AlignRight
diff --git a/examples/quick/demos/stocqt/content/StockSettingsPanel.qml b/examples/quick/demos/stocqt/content/StockSettingsPanel.qml
index 7d71355b31..0c34e453de 100644
--- a/examples/quick/demos/stocqt/content/StockSettingsPanel.qml
+++ b/examples/quick/demos/stocqt/content/StockSettingsPanel.qml
@@ -39,6 +39,7 @@
****************************************************************************/
import QtQuick 2.0
+import "."
Rectangle {
id: root
@@ -62,7 +63,7 @@ Rectangle {
anchors.left: root.left
anchors.top: root.top
color: "#000000"
- font.family: "Open Sans"
+ font.family: Settings.fontFamily
font.pointSize: 19
text: "Open"
}
@@ -73,7 +74,7 @@ Rectangle {
anchors.top: openText.bottom
anchors.topMargin: 10
color: "#000000"
- font.family: "Open Sans"
+ font.family: Settings.fontFamily
font.pointSize: 19
text: "Close"
}
@@ -84,7 +85,7 @@ Rectangle {
anchors.top: closeText.bottom
anchors.topMargin: 10
color: "#000000"
- font.family: "Open Sans"
+ font.family: Settings.fontFamily
font.pointSize: 19
text: "High"
}
@@ -95,7 +96,7 @@ Rectangle {
anchors.top: highText.bottom
anchors.topMargin: 10
color: "#000000"
- font.family: "Open Sans"
+ font.family: Settings.fontFamily
font.pointSize: 19
text: "Low"
}
diff --git a/examples/quick/demos/stocqt/content/qmldir b/examples/quick/demos/stocqt/content/qmldir
new file mode 100644
index 0000000000..bcfa27b484
--- /dev/null
+++ b/examples/quick/demos/stocqt/content/qmldir
@@ -0,0 +1,10 @@
+singleton Settings 1.0 Settings.qml
+Button 1.0 Button.qml
+CheckBox 1.0 CheckBox.qml
+StockChart 1.0 StockChart.qml
+StockInfo 1.0 StockInfo.qml
+StockListModel 1.0 StockListModel.qml
+StockListView 1.0 StockListView.qml
+StockModel 1.0 StockModel.qml
+StockSettingsPanel 1.0 StockSettingsPanel.qml
+StockView 1.0 StockView.qml
diff --git a/examples/quick/demos/stocqt/stocqt.qrc b/examples/quick/demos/stocqt/stocqt.qrc
index ee5dd0c24f..920e56d4d0 100644
--- a/examples/quick/demos/stocqt/stocqt.qrc
+++ b/examples/quick/demos/stocqt/stocqt.qrc
@@ -1,6 +1,7 @@
<RCC>
<qresource prefix="/demos/stocqt">
<file>stocqt.qml</file>
+ <file>content/qmldir</file>
<file>content/Button.qml</file>
<file>content/CheckBox.qml</file>
<file>content/StockChart.qml</file>
@@ -13,5 +14,7 @@
<file>content/images/icon-left-arrow.png</file>
<file>content/StockSettingsPanel.qml</file>
<file>content/StockInfo.qml</file>
+ <file>content/Settings.qml</file>
+ <file>content/+windows/Settings.qml</file>
</qresource>
</RCC>
diff --git a/src/qml/compiler/qqmlirbuilder.cpp b/src/qml/compiler/qqmlirbuilder.cpp
index e6c64c520a..9fcfe53b05 100644
--- a/src/qml/compiler/qqmlirbuilder.cpp
+++ b/src/qml/compiler/qqmlirbuilder.cpp
@@ -1882,17 +1882,17 @@ QV4::IR::Expr *JSCodeGen::fallbackNameLookup(const QString &name, int line, int
#ifndef V4_BOOTSTRAP
-QQmlPropertyData *PropertyResolver::property(const QString &name, bool *notInRevision, QObject *object, QQmlContextData *context)
+QQmlPropertyData *PropertyResolver::property(const QString &name, bool *notInRevision, RevisionCheck check)
{
if (notInRevision) *notInRevision = false;
- QQmlPropertyData *d = cache->property(name, object, context);
+ QQmlPropertyData *d = cache->property(name, 0, 0);
// Find the first property
while (d && d->isFunction())
d = cache->overrideData(d);
- if (d && !cache->isAllowedInRevision(d)) {
+ if (check != IgnoreRevision && d && !cache->isAllowedInRevision(d)) {
if (notInRevision) *notInRevision = true;
return 0;
} else {
@@ -1901,11 +1901,11 @@ QQmlPropertyData *PropertyResolver::property(const QString &name, bool *notInRev
}
-QQmlPropertyData *PropertyResolver::signal(const QString &name, bool *notInRevision, QObject *object, QQmlContextData *context)
+QQmlPropertyData *PropertyResolver::signal(const QString &name, bool *notInRevision)
{
if (notInRevision) *notInRevision = false;
- QQmlPropertyData *d = cache->property(name, object, context);
+ QQmlPropertyData *d = cache->property(name, 0, 0);
if (notInRevision) *notInRevision = false;
while (d && !(d->isFunction()))
@@ -1921,7 +1921,7 @@ QQmlPropertyData *PropertyResolver::signal(const QString &name, bool *notInRevis
if (name.endsWith(QStringLiteral("Changed"))) {
QString propName = name.mid(0, name.length() - static_cast<int>(strlen("Changed")));
- d = property(propName, notInRevision, object, context);
+ d = property(propName, notInRevision);
if (d)
return cache->signal(d->notifyIndex);
}
diff --git a/src/qml/compiler/qqmlirbuilder_p.h b/src/qml/compiler/qqmlirbuilder_p.h
index 3a92659dda..057ed1be9f 100644
--- a/src/qml/compiler/qqmlirbuilder_p.h
+++ b/src/qml/compiler/qqmlirbuilder_p.h
@@ -466,10 +466,15 @@ struct Q_QML_EXPORT PropertyResolver
return cache->property(index);
}
- QQmlPropertyData *property(const QString &name, bool *notInRevision = 0, QObject *object = 0, QQmlContextData *context = 0);
+ enum RevisionCheck {
+ CheckRevision,
+ IgnoreRevision
+ };
+
+ QQmlPropertyData *property(const QString &name, bool *notInRevision = 0, RevisionCheck check = CheckRevision);
// This code must match the semantics of QQmlPropertyPrivate::findSignalByName
- QQmlPropertyData *signal(const QString &name, bool *notInRevision, QObject *object = 0, QQmlContextData *context = 0);
+ QQmlPropertyData *signal(const QString &name, bool *notInRevision);
QQmlPropertyCache *cache;
};
diff --git a/src/qml/compiler/qqmltypecompiler.cpp b/src/qml/compiler/qqmltypecompiler.cpp
index f5bfe3c896..2b3cd93052 100644
--- a/src/qml/compiler/qqmltypecompiler.cpp
+++ b/src/qml/compiler/qqmltypecompiler.cpp
@@ -1865,6 +1865,7 @@ bool QQmlPropertyValidator::validateObject(int objectIndex, const QV4::CompiledD
}
bool bindingToDefaultProperty = false;
+ bool isGroupProperty = instantiatingBinding && instantiatingBinding->type == QV4::CompiledData::Binding::Type_GroupProperty;
bool notInRevision = false;
QQmlPropertyData *pd = 0;
@@ -1873,7 +1874,7 @@ bool QQmlPropertyValidator::validateObject(int objectIndex, const QV4::CompiledD
|| binding->flags & QV4::CompiledData::Binding::IsSignalHandlerObject)
pd = propertyResolver.signal(name, &notInRevision);
else
- pd = propertyResolver.property(name, &notInRevision);
+ pd = propertyResolver.property(name, &notInRevision, isGroupProperty ? QmlIR::PropertyResolver::IgnoreRevision : QmlIR::PropertyResolver::CheckRevision);
if (notInRevision) {
QString typeName = stringAt(obj->inheritedTypeNameIndex);
@@ -1885,7 +1886,7 @@ bool QQmlPropertyValidator::validateObject(int objectIndex, const QV4::CompiledD
}
}
} else {
- if (instantiatingBinding && instantiatingBinding->type == QV4::CompiledData::Binding::Type_GroupProperty)
+ if (isGroupProperty)
COMPILE_EXCEPTION(binding, tr("Cannot assign a value directly to a grouped property"));
pd = defaultProperty;
diff --git a/src/qml/jsruntime/qv4include.cpp b/src/qml/jsruntime/qv4include.cpp
index 606ba07adf..29f83da522 100644
--- a/src/qml/jsruntime/qv4include.cpp
+++ b/src/qml/jsruntime/qv4include.cpp
@@ -189,6 +189,8 @@ QV4::ReturnedValue QV4Include::method_include(QV4::CallContext *ctx)
V4THROW_ERROR("Qt.include(): Can only be called from JavaScript files");
QUrl url(scope.engine->resolvedUrl(ctx->args()[0].toQStringNoThrow()));
+ if (scope.engine->qmlEngine() && scope.engine->qmlEngine()->urlInterceptor())
+ url = scope.engine->qmlEngine()->urlInterceptor()->intercept(url, QQmlAbstractUrlInterceptor::JavaScriptFile);
QV4::ScopedValue callbackFunction(scope, QV4::Primitive::undefinedValue());
if (ctx->argc() >= 2 && ctx->args()[1].as<QV4::FunctionObject>())
diff --git a/src/qml/jsruntime/qv4persistent.cpp b/src/qml/jsruntime/qv4persistent.cpp
index 2a7a9a6ee7..f6d4046ec4 100644
--- a/src/qml/jsruntime/qv4persistent.cpp
+++ b/src/qml/jsruntime/qv4persistent.cpp
@@ -40,6 +40,7 @@
#include "qv4persistent_p.h"
#include <private/qv4mm_p.h>
#include "qv4object_p.h"
+#include "qv4qobjectwrapper_p.h"
#include "PageAllocation.h"
using namespace QV4;
@@ -387,7 +388,7 @@ WeakValue &WeakValue::operator=(const WeakValue &other)
WeakValue::~WeakValue()
{
- PersistentValueStorage::free(val);
+ free();
}
void WeakValue::set(ExecutionEngine *engine, const Value &value)
@@ -418,3 +419,21 @@ void WeakValue::markOnce(ExecutionEngine *e)
val->mark(e);
}
+void WeakValue::free()
+{
+ if (!val)
+ return;
+
+ ExecutionEngine *e = engine();
+ if (e && val->as<QObjectWrapper>()) {
+ // Some QV4::QObjectWrapper Value will be freed in WeakValue::~WeakValue() before MemoryManager::sweep() is being called,
+ // in this case we will never have a chance to call detroyObject() on those QV4::QObjectWrapper objects.
+ // Here we don't free these Value immediately, instead we keep track of them to free them later in MemoryManager::sweep()
+ e->memoryManager->m_pendingFreedObjectWrapperValue.push_back(val);
+ } else {
+ PersistentValueStorage::free(val);
+ }
+
+ val = 0;
+}
+
diff --git a/src/qml/jsruntime/qv4persistent_p.h b/src/qml/jsruntime/qv4persistent_p.h
index b8f179c9eb..5b1926468a 100644
--- a/src/qml/jsruntime/qv4persistent_p.h
+++ b/src/qml/jsruntime/qv4persistent_p.h
@@ -184,15 +184,15 @@ public:
bool isUndefined() const { return !val || val->isUndefined(); }
bool isNullOrUndefined() const { return !val || val->isNullOrUndefined(); }
- void clear() {
- PersistentValueStorage::free(val);
- val = 0;
- }
+ void clear() { free(); }
void markOnce(ExecutionEngine *e);
private:
Value *val;
+
+private:
+ void free();
};
} // namespace QV4
diff --git a/src/qml/memory/qv4mm.cpp b/src/qml/memory/qv4mm.cpp
index 18676ec8e6..fe94a11082 100644
--- a/src/qml/memory/qv4mm.cpp
+++ b/src/qml/memory/qv4mm.cpp
@@ -47,8 +47,6 @@
#include "StdLibExtras.h"
#include <QTime>
-#include <QVector>
-#include <QVector>
#include <QMap>
#include <iostream>
@@ -443,6 +441,21 @@ void MemoryManager::sweep(bool lastSweep)
(*it) = Primitive::undefinedValue();
}
+ // Now it is time to free QV4::QObjectWrapper Value, we must check the Value's tag to make sure its object has been destroyed
+ const int pendingCount = m_pendingFreedObjectWrapperValue.count();
+ if (pendingCount) {
+ QVector<Value *> remainingWeakQObjectWrappers;
+ remainingWeakQObjectWrappers.reserve(pendingCount);
+ for (int i = 0; i < pendingCount; ++i) {
+ Value *v = m_pendingFreedObjectWrapperValue.at(i);
+ if (v->tag() == Value::Undefined_Type)
+ PersistentValueStorage::free(v);
+ else
+ remainingWeakQObjectWrappers.append(v);
+ }
+ m_pendingFreedObjectWrapperValue = remainingWeakQObjectWrappers;
+ }
+
if (MultiplyWrappedQObjectMap *multiplyWrappedQObjects = engine->m_multiplyWrappedQObjects) {
for (MultiplyWrappedQObjectMap::Iterator it = multiplyWrappedQObjects->begin(); it != multiplyWrappedQObjects->end();) {
if (!it.value().isNullOrUndefined())
diff --git a/src/qml/memory/qv4mm_p.h b/src/qml/memory/qv4mm_p.h
index b1503ad963..e169675f7d 100644
--- a/src/qml/memory/qv4mm_p.h
+++ b/src/qml/memory/qv4mm_p.h
@@ -55,6 +55,7 @@
#include <private/qv4value_p.h>
#include <private/qv4scopedvalue_p.h>
#include <private/qv4object_p.h>
+#include <QVector>
//#define DETAILED_MM_STATS
@@ -333,6 +334,7 @@ public:
QScopedPointer<Data> m_d;
PersistentValueStorage *m_persistentValues;
PersistentValueStorage *m_weakValues;
+ QVector<Value *> m_pendingFreedObjectWrapperValue;
};
}
diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp
index a5173e9efb..576478b729 100644
--- a/src/qml/qml/qqmlmetatype.cpp
+++ b/src/qml/qml/qqmlmetatype.cpp
@@ -250,7 +250,7 @@ void QQmlType::SingletonInstanceInfo::destroy(QQmlEngine *e)
QObject *o = qobjectApis.take(e);
if (o) {
QQmlData *ddata = QQmlData::get(o, false);
- if (ddata && ddata->indestructible)
+ if (url.isEmpty() && ddata && ddata->indestructible && ddata->explicitIndestructibleSet)
return;
delete o;
}
diff --git a/src/qml/qml/qqmlvaluetypewrapper.cpp b/src/qml/qml/qqmlvaluetypewrapper.cpp
index 486feca7cb..d313557e98 100644
--- a/src/qml/qml/qqmlvaluetypewrapper.cpp
+++ b/src/qml/qml/qqmlvaluetypewrapper.cpp
@@ -363,8 +363,14 @@ ReturnedValue QQmlValueTypeWrapper::get(const Managed *m, String *name, bool *ha
VALUE_TYPE_LOAD(QMetaType::QString, QString, v4->newString);
VALUE_TYPE_LOAD(QMetaType::Bool, bool, bool);
- QVariant v(result->propType, (void *)0);
- void *args[] = { v.data(), 0 };
+ QVariant v;
+ void *args[] = { Q_NULLPTR, Q_NULLPTR };
+ if (result->propType == QMetaType::QVariant) {
+ args[0] = &v;
+ } else {
+ v = QVariant(result->propType, static_cast<void *>(Q_NULLPTR));
+ args[0] = v.data();
+ }
metaObject->d.static_metacall(reinterpret_cast<QObject*>(gadget), QMetaObject::ReadProperty, index, args);
return v4->fromVariant(v);
#undef VALUE_TYPE_ACCESSOR
diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp
index b2507fb99e..91eef2d982 100644
--- a/src/qml/types/qqmllistmodel.cpp
+++ b/src/qml/types/qqmllistmodel.cpp
@@ -2276,6 +2276,9 @@ QQmlV4Handle QQmlListModel::get(int index) const
} else {
QObject *object = m_listModel->getOrCreateModelObject(const_cast<QQmlListModel *>(this), index);
result = scope.engine->memoryManager->allocObject<QV4::ModelObject>(object, const_cast<QQmlListModel *>(this), index);
+ // Keep track of the QObjectWrapper in persistent value storage
+ QV4::Value *val = scope.engine->memoryManager->m_weakValues->allocate();
+ *val = result;
}
}
diff --git a/src/quick/doc/src/concepts/statesanimations/states.qdoc b/src/quick/doc/src/concepts/statesanimations/states.qdoc
index b48a051379..981499ebc5 100644
--- a/src/quick/doc/src/concepts/statesanimations/states.qdoc
+++ b/src/quick/doc/src/concepts/statesanimations/states.qdoc
@@ -74,7 +74,7 @@ configurations with the \c PropertyChanges type.
\snippet qml/states.qml signal states
The \l PropertyChanges type will change the values of object properties.
Objects are referenced through their
-\l{qtqml-syntax-objectattributes.html#the-id-assignment}{id}. Objects outside
+\l{qtqml-syntax-objectattributes.html#the-id-attribute}{id}. Objects outside
the component are also referenced using the \c id property, exemplified by the
property change to the external \c flag object.
diff --git a/src/quick/items/qquickanimatedsprite_p.h b/src/quick/items/qquickanimatedsprite_p.h
index b2633619d5..6b49d903df 100644
--- a/src/quick/items/qquickanimatedsprite_p.h
+++ b/src/quick/items/qquickanimatedsprite_p.h
@@ -53,7 +53,7 @@
#include <QtQuick/QQuickItem>
#include <private/qquicksprite_p.h>
-#include <QTime>
+#include <QtCore/qelapsedtimer.h>
QT_BEGIN_NAMESPACE
@@ -372,7 +372,7 @@ private:
QQuickAnimatedSpriteMaterial *m_material;
QQuickSprite* m_sprite;
QQuickSpriteEngine* m_spriteEngine;
- QTime m_timestamp;
+ QElapsedTimer m_timestamp;
int m_curFrame;
bool m_pleaseReset;
bool m_running;
diff --git a/src/quick/items/qquickdroparea.cpp b/src/quick/items/qquickdroparea.cpp
index aecdcdbc28..1701441240 100644
--- a/src/quick/items/qquickdroparea.cpp
+++ b/src/quick/items/qquickdroparea.cpp
@@ -270,6 +270,8 @@ void QQuickDropArea::dragEnterEvent(QDragEnterEvent *event)
QQuickDropEvent dragTargetEvent(d, event);
emit entered(&dragTargetEvent);
+ if (!event->isAccepted())
+ return;
d->containsDrag = true;
if (QQuickDragMimeData *dragMime = qobject_cast<QQuickDragMimeData *>(const_cast<QMimeData *>(mimeData)))
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index dec2351de8..5be1c86fb4 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -4257,7 +4257,7 @@ void QQuickItem::setBaselineOffset(qreal offset)
* The call to QQuickItem::updatePaintNode() will always happen if the
* item is showing in a QQuickWindow.
*
- * Only items which specifies QQuickItem::ItemHasContents are allowed
+ * Only items which specify QQuickItem::ItemHasContents are allowed
* to call QQuickItem::update().
*/
void QQuickItem::update()
@@ -4297,7 +4297,7 @@ void QQuickItem::polish()
\qmlmethod object QtQuick::Item::mapFromItem(Item item, real x, real y, real width, real height)
Maps the point (\a x, \a y) or rect (\a x, \a y, \a width, \a height), which is in \a
- item's coordinate system, to this item's coordinate system, and returns a \l point or \rect
+ item's coordinate system, to this item's coordinate system, and returns a \l point or \l rect
matching the mapped coordinate.
If \a item is a \c null value, this maps the point or rect from the coordinate system of
diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp
index e140d61dee..f0bbb1e732 100644
--- a/src/quick/items/qquickpathview.cpp
+++ b/src/quick/items/qquickpathview.cpp
@@ -1984,6 +1984,7 @@ void QQuickPathView::refill()
break;
}
if (d->items.contains(item)) {
+ d->releaseItem(item);
break; //Otherwise we'd "re-add" it, and get confused
}
if (d->currentIndex == idx) {
@@ -2014,6 +2015,7 @@ void QQuickPathView::refill()
break;
}
if (d->items.contains(item)) {
+ d->releaseItem(item);
break; //Otherwise we'd "re-add" it, and get confused
}
if (d->currentIndex == idx) {
@@ -2055,6 +2057,8 @@ void QQuickPathView::refill()
int lastListIdx = d->items.indexOf(lastItem);
d->items.insert(lastListIdx + 1, item);
d->updateItem(item, nextPos);
+ } else {
+ d->releaseItem(item);
}
lastItem = item;
diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp
index 97e00362be..0f7f1961a1 100644
--- a/src/quick/items/qquicktext.cpp
+++ b/src/quick/items/qquicktext.cpp
@@ -234,7 +234,7 @@ void QQuickTextPrivate::setBottomPadding(qreal value, bool reset)
The default is true.
*/
-void QQuickText::q_imagesLoaded()
+void QQuickText::q_updateLayout()
{
Q_D(QQuickText);
d->updateLayout();
@@ -1180,7 +1180,7 @@ void QQuickTextPrivate::ensureDoc()
extra->doc->setDocumentMargin(0);
extra->doc->setBaseUrl(q->baseUrl());
qmlobject_connect(extra->doc, QQuickTextDocumentWithImageResources, SIGNAL(imagesLoaded()),
- q, QQuickText, SLOT(q_imagesLoaded()));
+ q, QQuickText, SLOT(q_updateLayout()));
}
}
diff --git a/src/quick/items/qquicktext_p.h b/src/quick/items/qquicktext_p.h
index 87cde29199..0b35ad5f91 100644
--- a/src/quick/items/qquicktext_p.h
+++ b/src/quick/items/qquicktext_p.h
@@ -298,7 +298,7 @@ protected:
void invalidateFontCaches();
private Q_SLOTS:
- void q_imagesLoaded();
+ void q_updateLayout();
void triggerPreprocess();
void imageDownloadFinished();
diff --git a/src/quick/items/qquicktextnode.cpp b/src/quick/items/qquicktextnode.cpp
index d05f51d1ac..7ee01b5398 100644
--- a/src/quick/items/qquicktextnode.cpp
+++ b/src/quick/items/qquicktextnode.cpp
@@ -90,50 +90,6 @@ QQuickTextNode::~QQuickTextNode()
qDeleteAll(m_textures);
}
-#if 0
-void QQuickTextNode::setColor(const QColor &color)
-{
- if (m_usePixmapCache) {
- setUpdateFlag(UpdateNodes);
- } else {
- for (QSGNode *childNode = firstChild(); childNode; childNode = childNode->nextSibling()) {
- if (childNode->subType() == GlyphNodeSubType) {
- QSGGlyphNode *glyphNode = static_cast<QSGGlyphNode *>(childNode);
- if (glyphNode->color() == m_color)
- glyphNode->setColor(color);
- } else if (childNode->subType() == SolidRectNodeSubType) {
- QSGSimpleRectNode *solidRectNode = static_cast<QSGSimpleRectNode *>(childNode);
- if (solidRectNode->color() == m_color)
- solidRectNode->setColor(color);
- }
- }
- }
- m_color = color;
-}
-
-void QQuickTextNode::setStyleColor(const QColor &styleColor)
-{
- if (m_textStyle != QQuickTextNode::NormalTextStyle) {
- if (m_usePixmapCache) {
- setUpdateFlag(UpdateNodes);
- } else {
- for (QSGNode *childNode = firstChild(); childNode; childNode = childNode->nextSibling()) {
- if (childNode->subType() == GlyphNodeSubType) {
- QSGGlyphNode *glyphNode = static_cast<QSGGlyphNode *>(childNode);
- if (glyphNode->color() == m_styleColor)
- glyphNode->setColor(styleColor);
- } else if (childNode->subType() == SolidRectNodeSubType) {
- QSGSimpleRectNode *solidRectNode = static_cast<QSGSimpleRectNode *>(childNode);
- if (solidRectNode->color() == m_styleColor)
- solidRectNode->setColor(styleColor);
- }
- }
- }
- }
- m_styleColor = styleColor;
-}
-#endif
-
QSGGlyphNode *QQuickTextNode::addGlyphs(const QPointF &position, const QGlyphRun &glyphs, const QColor &color,
QQuickText::TextStyle style, const QColor &styleColor,
QSGNode *parentNode)
@@ -318,78 +274,4 @@ void QQuickTextNode::deleteContent()
m_textures.clear();
}
-#if 0
-void QQuickTextNode::updateNodes()
-{
- return;
- deleteContent();
- if (m_text.isEmpty())
- return;
-
- if (m_usePixmapCache) {
- // ### gunnar: port properly
-// QPixmap pixmap = generatedPixmap();
-// if (pixmap.isNull())
-// return;
-
-// QSGImageNode *pixmapNode = m_context->createImageNode();
-// pixmapNode->setRect(pixmap.rect());
-// pixmapNode->setSourceRect(pixmap.rect());
-// pixmapNode->setOpacity(m_opacity);
-// pixmapNode->setClampToEdge(true);
-// pixmapNode->setLinearFiltering(m_linearFiltering);
-
-// appendChildNode(pixmapNode);
- } else {
- if (m_text.isEmpty())
- return;
-
- // Implement styling by drawing text several times at slight shifts. shiftForStyle
- // contains the sequence of shifted positions at which to draw the text. All except
- // the last will be drawn with styleColor.
- QList<QPointF> shiftForStyle;
- switch (m_textStyle) {
- case OutlineTextStyle:
- // ### Should be made faster by implementing outline material
- shiftForStyle << QPointF(-1, 0);
- shiftForStyle << QPointF(0, -1);
- shiftForStyle << QPointF(1, 0);
- shiftForStyle << QPointF(0, 1);
- break;
- case SunkenTextStyle:
- shiftForStyle << QPointF(0, -1);
- break;
- case RaisedTextStyle:
- shiftForStyle << QPointF(0, 1);
- break;
- default:
- break;
- }
-
- shiftForStyle << QPointF(0, 0); // Regular position
- while (!shiftForStyle.isEmpty()) {
- QPointF shift = shiftForStyle.takeFirst();
-
- // Use styleColor for all but last shift
- if (m_richText) {
- QColor overrideColor = shiftForStyle.isEmpty() ? QColor() : m_styleColor;
-
- QTextFrame *textFrame = m_textDocument->rootFrame();
- QPointF p = m_textDocument->documentLayout()->frameBoundingRect(textFrame).topLeft();
-
- QTextFrame::iterator it = textFrame->begin();
- while (!it.atEnd()) {
- addTextBlock(shift + p, it.currentBlock(), overrideColor);
- ++it;
- }
- } else {
- addTextLayout(shift, m_textLayout, shiftForStyle.isEmpty()
- ? m_color
- : m_styleColor);
- }
- }
- }
-}
-#endif
-
QT_END_NAMESPACE
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index f2cfeb56aa..635f1da77e 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -294,6 +294,13 @@ void QQuickWindow::update()
QQuickRenderControlPrivate::get(d->renderControl)->update();
}
+void QQuickWindow::handleScreenChanged(QScreen *screen)
+{
+ Q_D(QQuickWindow);
+ Q_UNUSED(screen)
+ d->forcePolish();
+}
+
void forcePolishHelper(QQuickItem *item)
{
if (item->flags() & QQuickItem::ItemHasContents) {
@@ -308,12 +315,12 @@ void forcePolishHelper(QQuickItem *item)
/*!
Schedules polish events on all items in the scene.
*/
-void QQuickWindow::forcePolish()
+void QQuickWindowPrivate::forcePolish()
{
- Q_D(QQuickWindow);
- if (!screen())
+ Q_Q(QQuickWindow);
+ if (!q->screen())
return;
- forcePolishHelper(d->contentItem);
+ forcePolishHelper(contentItem);
}
void forceUpdate(QQuickItem *item)
@@ -484,7 +491,7 @@ void QQuickWindowPrivate::init(QQuickWindow *c, QQuickRenderControl *control)
QObject::connect(context, SIGNAL(invalidated()), q, SLOT(cleanupSceneGraph()), Qt::DirectConnection);
QObject::connect(q, SIGNAL(focusObjectChanged(QObject*)), q, SIGNAL(activeFocusItemChanged()));
- QObject::connect(q, SIGNAL(screenChanged(QScreen*)), q, SLOT(forcePolish()));
+ QObject::connect(q, SIGNAL(screenChanged(QScreen*)), q, SLOT(handleScreenChanged(QScreen*)));
QObject::connect(q, SIGNAL(frameSwapped()), q, SLOT(runJobsAfterSwap()), Qt::DirectConnection);
@@ -4012,7 +4019,7 @@ void QQuickWindow::resetOpenGLState()
*/
/*!
- \qmlproperty Window::active
+ \qmlproperty bool Window::active
\since 5.1
The active status of the window.
diff --git a/src/quick/items/qquickwindow.h b/src/quick/items/qquickwindow.h
index c101ac5239..262828ad1d 100644
--- a/src/quick/items/qquickwindow.h
+++ b/src/quick/items/qquickwindow.h
@@ -202,7 +202,7 @@ protected:
private Q_SLOTS:
void maybeUpdate();
void cleanupSceneGraph();
- void forcePolish();
+ void handleScreenChanged(QScreen *screen);
void setTransientParent_helper(QQuickWindow *window);
void runJobsAfterSwap();
diff --git a/src/quick/items/qquickwindow_p.h b/src/quick/items/qquickwindow_p.h
index 54cdcf8da1..652320c1c9 100644
--- a/src/quick/items/qquickwindow_p.h
+++ b/src/quick/items/qquickwindow_p.h
@@ -196,6 +196,7 @@ public:
void cleanup(QSGNode *);
void polishItems();
+ void forcePolish();
void syncSceneGraph();
void renderSceneGraph(const QSize &size);
diff --git a/tests/auto/qml/qqmlecmascript/data/metaobjectRevision5.qml b/tests/auto/qml/qqmlecmascript/data/metaobjectRevision5.qml
new file mode 100644
index 0000000000..0493a7c0b9
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/metaobjectRevision5.qml
@@ -0,0 +1,12 @@
+import Qt.test 1.1
+import QtQuick 2.0
+
+MyItemUsingRevisionedObject {
+ property real test
+
+ revisioned.prop1: 10
+ revisioned.prop2: 1
+
+ Component.onCompleted: test = revisioned.prop1 + revisioned.prop2
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/testtypes.cpp b/tests/auto/qml/qqmlecmascript/testtypes.cpp
index 70bf50cae4..2afa21ddd6 100644
--- a/tests/auto/qml/qqmlecmascript/testtypes.cpp
+++ b/tests/auto/qml/qqmlecmascript/testtypes.cpp
@@ -447,6 +447,7 @@ void registerTypes()
qmlRegisterType<MyRevisionedSubclass>("Qt.test",1,0,"MyRevisionedSubclass");
// MyRevisionedSubclass 1.1 uses MyRevisionedClass revision 1
qmlRegisterType<MyRevisionedSubclass,1>("Qt.test",1,1,"MyRevisionedSubclass");
+ qmlRegisterType<MyItemUsingRevisionedObject>("Qt.test", 1, 0, "MyItemUsingRevisionedObject");
#ifndef QT_NO_WIDGETS
qmlRegisterExtendedType<QWidget,QWidgetDeclarativeUI>("Qt.test",1,0,"QWidget");
diff --git a/tests/auto/qml/qqmlecmascript/testtypes.h b/tests/auto/qml/qqmlecmascript/testtypes.h
index 1a740b9a93..e0d75e7baa 100644
--- a/tests/auto/qml/qqmlecmascript/testtypes.h
+++ b/tests/auto/qml/qqmlecmascript/testtypes.h
@@ -1079,10 +1079,27 @@ protected:
qreal m_p4;
};
+
+class MyItemUsingRevisionedObject : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(MyRevisionedClass *revisioned READ revisioned)
+
+public:
+ MyItemUsingRevisionedObject() {
+ m_revisioned = new MyRevisionedClass;
+ }
+
+ MyRevisionedClass *revisioned() const { return m_revisioned; }
+private:
+ MyRevisionedClass *m_revisioned;
+};
+
QML_DECLARE_TYPE(MyRevisionedBaseClassRegistered)
QML_DECLARE_TYPE(MyRevisionedBaseClassUnregistered)
QML_DECLARE_TYPE(MyRevisionedClass)
QML_DECLARE_TYPE(MyRevisionedSubclass)
+QML_DECLARE_TYPE(MyItemUsingRevisionedObject)
Q_DECLARE_METATYPE(MyQmlObject::MyType)
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index a16f9a356c..5ca760020c 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -6573,6 +6573,15 @@ void tst_qqmlecmascript::revision()
QCOMPARE(object->property("test").toReal(), 11.);
delete object;
}
+
+ {
+ QQmlComponent component(&engine, testFileUrl("metaobjectRevision5.qml"));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("test").toReal(), 11.);
+ delete object;
+ }
}
void tst_qqmlecmascript::realToInt()
diff --git a/tests/auto/qml/qqmlengine/data/interception/includes/Intercepted.qml b/tests/auto/qml/qqmlengine/data/interception/includes/Intercepted.qml
new file mode 100644
index 0000000000..449207e0e3
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/interception/includes/Intercepted.qml
@@ -0,0 +1,5 @@
+import QtQml 2.0
+
+QtObject {
+ property string myStr: "base file"
+}
diff --git a/tests/auto/qml/qqmlengine/data/interception/includes/intercepted.js b/tests/auto/qml/qqmlengine/data/interception/includes/intercepted.js
new file mode 100644
index 0000000000..fef9f3cd44
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/interception/includes/intercepted.js
@@ -0,0 +1,3 @@
+Qt.include("intercepted/included.js")
+
+var myStr = myString()
diff --git a/tests/auto/qml/qqmlengine/data/interception/includes/intercepted/included.js b/tests/auto/qml/qqmlengine/data/interception/includes/intercepted/included.js
new file mode 100644
index 0000000000..b6e141dfaa
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/interception/includes/intercepted/included.js
@@ -0,0 +1,3 @@
+function myString() {
+ return "base include file";
+}
diff --git a/tests/auto/qml/qqmlengine/data/interception/includes/intercepted/intercepted.js b/tests/auto/qml/qqmlengine/data/interception/includes/intercepted/intercepted.js
new file mode 100644
index 0000000000..fef9f3cd44
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/interception/includes/intercepted/intercepted.js
@@ -0,0 +1,3 @@
+Qt.include("intercepted/included.js")
+
+var myStr = myString()
diff --git a/tests/auto/qml/qqmlengine/data/interception/includes/intercepted/intercepted/included.js b/tests/auto/qml/qqmlengine/data/interception/includes/intercepted/intercepted/included.js
new file mode 100644
index 0000000000..c0215ebbe5
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/interception/includes/intercepted/intercepted/included.js
@@ -0,0 +1,3 @@
+function myString() {
+ return "intercepted include file";
+}
diff --git a/tests/auto/qml/qqmlengine/data/interception/includes/urlInterceptor.qml b/tests/auto/qml/qqmlengine/data/interception/includes/urlInterceptor.qml
new file mode 100644
index 0000000000..be86195bd8
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/interception/includes/urlInterceptor.qml
@@ -0,0 +1,11 @@
+import QtQml 2.0
+import "intercepted.js" as Script
+
+QtObject {
+ property url filePath: "doesNotExist.file"
+ property url resolvedUrl: Qt.resolvedUrl("doesNotExist.file");
+ property url absoluteUrl: Qt.resolvedUrl("file:///doesNotExist.file");
+ property string childString: child.myStr
+ property string scriptString: Script.myStr
+ property Intercepted child: Intercepted {}
+}
diff --git a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp
index a6f0ff6efb..3208745c5c 100644
--- a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp
+++ b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp
@@ -741,6 +741,15 @@ void tst_qqmlengine::urlInterceptor_data()
<< QStringLiteral("base file")
<< testFileUrl("interception/strings/intercepted/doesNotExist.file").toString()
<< QStringLiteral("file:///intercepted/doesNotExist.file");
+
+ QTest::newRow("InterceptIncludes")
+ << testFileUrl("interception/includes/urlInterceptor.qml")
+ << (QList<QQmlAbstractUrlInterceptor::DataType>() << QQmlAbstractUrlInterceptor::JavaScriptFile)
+ << testFileUrl("interception/includes/doesNotExist.file").toString()
+ << QStringLiteral("base file")
+ << QStringLiteral("intercepted include file")
+ << testFileUrl("interception/includes/doesNotExist.file").toString()
+ << QStringLiteral("file:///doesNotExist.file");
}
void tst_qqmlengine::urlInterceptor()
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index fc85eae148..45507e83ea 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -244,6 +244,8 @@ private slots:
void dataAlignment();
+ void deleteSingletons();
+
private:
QQmlEngine engine;
QStringList defaultImportPathList;
@@ -4082,6 +4084,24 @@ void tst_qqmllanguage::dataAlignment()
QVERIFY(sizeof(QQmlVMEMetaData::MethodData) % sizeof(int) == 0);
}
+void tst_qqmllanguage::deleteSingletons()
+{
+ QPointer<QObject> singleton;
+ {
+ QQmlEngine tmpEngine;
+ QQmlComponent component(&tmpEngine, testFile("singletonTest5.qml"));
+ VERIFY_ERRORS(0);
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ QObject *s1 = NULL;
+ getSingletonInstance(o, "singletonInstance", &s1);
+ QVERIFY(s1 != 0);
+ singleton = s1;
+ QVERIFY(singleton.data() != 0);
+ }
+ QVERIFY(singleton.data() == 0);
+}
+
QTEST_MAIN(tst_qqmllanguage)
#include "tst_qqmllanguage.moc"
diff --git a/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp
index d0b7737794..300f5b90e5 100644
--- a/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp
+++ b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp
@@ -1490,6 +1490,7 @@ struct MyOffice
{
Q_PROPERTY(int chairs MEMBER m_chairs)
Q_PROPERTY(MyDesk desk READ desk WRITE setDesk)
+ Q_PROPERTY(QVariant myThing READ myThing WRITE setMyThing)
Q_GADGET
public:
MyOffice() : m_chairs(0) {}
@@ -1497,8 +1498,12 @@ public:
MyDesk desk() const { return m_desk; }
void setDesk(const MyDesk &d) { m_desk = d; }
+ QVariant myThing() const { return m_myThing; }
+ void setMyThing(const QVariant &thingy) { m_myThing = thingy; }
+
int m_chairs;
MyDesk m_desk;
+ QVariant m_myThing;
};
Q_DECLARE_METATYPE(MyOffice)
@@ -1510,6 +1515,11 @@ void tst_qqmlvaluetypes::customValueType()
MyOffice cppOffice;
cppOffice.m_chairs = 2;
+ QVariantMap m;
+ m.insert(QStringLiteral("hasChair"), false);
+ m.insert(QStringLiteral("textOnWhiteboard"), QStringLiteral("Blah blah"));
+ cppOffice.m_myThing = m;
+
QJSValue office = engine.toScriptValue(cppOffice);
QCOMPARE(office.property("chairs").toInt(), 2);
office.setProperty("chairs", 1);
@@ -1527,6 +1537,14 @@ void tst_qqmlvaluetypes::customValueType()
cppOffice = engine.fromScriptValue<MyOffice>(office);
QCOMPARE(cppOffice.m_chairs, 1);
QCOMPARE(cppOffice.desk().monitorCount, 2);
+
+ QJSValue thingy = office.property("myThing");
+ QVERIFY(thingy.hasProperty("hasChair"));
+ QVERIFY(thingy.property("hasChair").isBool());
+ QCOMPARE(thingy.property("hasChair").toBool(), false);
+ QVERIFY(thingy.property("textOnWhiteboard").isString());
+ QVERIFY(thingy.hasProperty("textOnWhiteboard"));
+ QCOMPARE(thingy.property("textOnWhiteboard").toString(), QStringLiteral("Blah blah"));
}
struct BaseGadget
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
index 1e3d1d95b3..405acad165 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -376,7 +376,7 @@ void tst_QQuickListView::cleanupTestCase()
template <class T>
void tst_QQuickListView::items(const QUrl &source)
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
T model;
model.addItem("Fred", "12345");
@@ -453,7 +453,6 @@ void tst_QQuickListView::items(const QUrl &source)
QTRY_COMPARE(listview->highlightResizeVelocity(), 1000.0);
QTRY_COMPARE(listview->highlightMoveVelocity(), 100000.0);
- delete window;
delete testObject;
}
@@ -461,7 +460,7 @@ void tst_QQuickListView::items(const QUrl &source)
template <class T>
void tst_QQuickListView::changed(const QUrl &source)
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
T model;
model.addItem("Fred", "12345");
@@ -495,16 +494,15 @@ void tst_QQuickListView::changed(const QUrl &source)
QTRY_VERIFY(number != 0);
QTRY_COMPARE(number->text(), model.number(1));
- delete window;
delete testObject;
}
template <class T>
void tst_QQuickListView::inserted(const QUrl &source)
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
T model;
model.addItem("Fred", "12345");
@@ -593,7 +591,6 @@ void tst_QQuickListView::inserted(const QUrl &source)
QVERIFY(item);
QTRY_COMPARE(item->y() - listview->contentY(), 0.);
- delete window;
delete testObject;
}
@@ -897,7 +894,7 @@ void tst_QQuickListView::insertBeforeVisible_data()
template <class T>
void tst_QQuickListView::removed(const QUrl &source, bool /* animated */)
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
T model;
for (int i = 0; i < 50; i++)
@@ -911,7 +908,7 @@ void tst_QQuickListView::removed(const QUrl &source, bool /* animated */)
window->setSource(source);
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
QTRY_VERIFY(listview != 0);
@@ -1070,7 +1067,6 @@ void tst_QQuickListView::removed(const QUrl &source, bool /* animated */)
model.removeItems(model.count() - 1, 1);
QTRY_VERIFY(findItems<QQuickItem>(contentItem, "wrapper").count() > 16);
- delete window;
delete testObject;
}
@@ -1264,7 +1260,7 @@ void tst_QQuickListView::removed_more_data()
template <class T>
void tst_QQuickListView::clear(const QUrl &source, QQuickItemView::VerticalLayoutDirection verticalLayoutDirection)
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
T model;
for (int i = 0; i < 30; i++)
@@ -1278,7 +1274,7 @@ void tst_QQuickListView::clear(const QUrl &source, QQuickItemView::VerticalLayou
window->setSource(source);
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
QTRY_VERIFY(listview != 0);
@@ -1308,7 +1304,6 @@ void tst_QQuickListView::clear(const QUrl &source, QQuickItemView::VerticalLayou
QVERIFY(listview->currentItem() != 0);
QCOMPARE(listview->currentIndex(), 0);
- delete window;
delete testObject;
}
@@ -1801,7 +1796,7 @@ void tst_QQuickListView::multipleChanges_data()
void tst_QQuickListView::swapWithFirstItem()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
QaimModel model;
for (int i = 0; i < 30; i++)
@@ -1815,7 +1810,7 @@ void tst_QQuickListView::swapWithFirstItem()
window->setSource(testFileUrl("listviewtest.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
QTRY_VERIFY(listview != 0);
@@ -1827,12 +1822,11 @@ void tst_QQuickListView::swapWithFirstItem()
QTRY_COMPARE(listview->contentY(), qreal(0));
delete testObject;
- delete window;
}
void tst_QQuickListView::enforceRange()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
QaimModel model;
for (int i = 0; i < 30; i++)
@@ -1843,7 +1837,7 @@ void tst_QQuickListView::enforceRange()
window->setSource(testFileUrl("listview-enforcerange.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
QTRY_VERIFY(listview != 0);
@@ -1880,8 +1874,6 @@ void tst_QQuickListView::enforceRange()
ctxt->setContextProperty("testModel", &model2);
QCOMPARE(listview->count(), 5);
-
- delete window;
}
void tst_QQuickListView::enforceRange_withoutHighlight()
@@ -1891,7 +1883,7 @@ void tst_QQuickListView::enforceRange_withoutHighlight()
// to the correct position (i.e. to the next/previous item, not next/previous section)
// when moving up/down via incrementCurrentIndex() and decrementCurrentIndex()
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
QaimModel model;
model.addItem("Item 0", "a");
@@ -1904,7 +1896,7 @@ void tst_QQuickListView::enforceRange_withoutHighlight()
window->setSource(testFileUrl("listview-enforcerange-nohighlight.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
QTRY_VERIFY(listview != 0);
@@ -1916,24 +1908,22 @@ void tst_QQuickListView::enforceRange_withoutHighlight()
QTRY_COMPARE(listview->contentY(), expectedPos);
expectedPos += 20 + 10; // scroll past 1st section and section delegate of 2nd section
- QTest::keyClick(window, Qt::Key_Down);
+ QTest::keyClick(window.data(), Qt::Key_Down);
QTRY_COMPARE(listview->contentY(), expectedPos);
expectedPos += 20; // scroll past 1st item of 2nd section
- QTest::keyClick(window, Qt::Key_Down);
+ QTest::keyClick(window.data(), Qt::Key_Down);
QTRY_COMPARE(listview->contentY(), expectedPos);
expectedPos += 20 + 10; // scroll past 2nd item of 2nd section and section delegate of 3rd section
- QTest::keyClick(window, Qt::Key_Down);
+ QTest::keyClick(window.data(), Qt::Key_Down);
QTRY_COMPARE(listview->contentY(), expectedPos);
-
- delete window;
}
void tst_QQuickListView::spacing()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
QaimModel model;
for (int i = 0; i < 30; i++)
@@ -1947,7 +1937,7 @@ void tst_QQuickListView::spacing()
window->setSource(testFileUrl("listviewtest.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
QTRY_VERIFY(listview != 0);
@@ -1988,14 +1978,13 @@ void tst_QQuickListView::spacing()
QTRY_COMPARE(item->y(), i*20.0);
}
- delete window;
delete testObject;
}
template <typename T>
void tst_QQuickListView::sections(const QUrl &source)
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
T model;
for (int i = 0; i < 30; i++)
@@ -2006,7 +1995,7 @@ void tst_QQuickListView::sections(const QUrl &source)
window->setSource(source);
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
QTRY_VERIFY(listview != 0);
@@ -2091,13 +2080,11 @@ void tst_QQuickListView::sections(const QUrl &source)
item = findItem<QQuickItem>(contentItem, "wrapper", 1);
QTRY_VERIFY(item);
QTRY_COMPARE(item->height(), 40.0);
-
- delete window;
}
void tst_QQuickListView::sectionsDelegate()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
QaimModel model;
for (int i = 0; i < 30; i++)
@@ -2108,7 +2095,7 @@ void tst_QQuickListView::sectionsDelegate()
window->setSource(testFileUrl("listview-sections_delegate.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
QTRY_VERIFY(listview != 0);
@@ -2187,8 +2174,6 @@ void tst_QQuickListView::sectionsDelegate()
QVERIFY(item);
QTRY_COMPARE(item->y(), qreal(i*20*4));
}
-
- delete window;
}
void tst_QQuickListView::sectionsDragOutsideBounds_data()
@@ -2256,7 +2241,7 @@ void tst_QQuickListView::sectionsDelegate_headerVisibility()
{
QSKIP("QTBUG-24395");
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
QaimModel model;
for (int i = 0; i < 30; i++)
@@ -2265,9 +2250,9 @@ void tst_QQuickListView::sectionsDelegate_headerVisibility()
window->rootContext()->setContextProperty("testModel", &model);
window->setSource(testFileUrl("listview-sections_delegate.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
window->requestActivate();
- QTest::qWaitForWindowActive(window);
+ QTest::qWaitForWindowActive(window.data());
QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
QTRY_VERIFY(listview != 0);
@@ -2283,13 +2268,11 @@ void tst_QQuickListView::sectionsDelegate_headerVisibility()
QTRY_VERIFY(!listview->isMoving());
listview->setCurrentIndex(0);
QTRY_VERIFY(qFuzzyIsNull(listview->contentY()));
-
- delete window;
}
void tst_QQuickListView::sectionsPositioning()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
QaimModel model;
for (int i = 0; i < 30; i++)
@@ -2300,7 +2283,7 @@ void tst_QQuickListView::sectionsPositioning()
window->setSource(testFileUrl("listview-sections_delegate.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
window->rootObject()->setProperty("sectionPositioning", QVariant(int(QQuickViewSection::InlineLabels | QQuickViewSection::CurrentLabelAtStart | QQuickViewSection::NextLabelAtEnd)));
QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
@@ -2450,17 +2433,15 @@ void tst_QQuickListView::sectionsPositioning()
model.clear();
QTRY_VERIFY(!findVisibleChild(contentItem, "sect_aaa")); // section header
QTRY_VERIFY(!findVisibleChild(contentItem, "sect_new")); // section footer
-
- delete window;
}
void tst_QQuickListView::sectionPropertyChange()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("sectionpropertychange.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
QTRY_VERIFY(listview != 0);
@@ -2516,17 +2497,15 @@ void tst_QQuickListView::sectionPropertyChange()
QTRY_VERIFY(item);
QTRY_COMPARE(item->y(), qreal(25. + i*75.));
}
-
- delete window;
}
void tst_QQuickListView::sectionDelegateChange()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("sectiondelegatechange.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QQuickListView *listview = qobject_cast<QQuickListView *>(window->rootObject());
QVERIFY(listview != 0);
@@ -2556,14 +2535,12 @@ void tst_QQuickListView::sectionDelegateChange()
QVERIFY(item);
QTRY_COMPARE(item->y(), qreal(50. + i*75.));
}
-
- delete window;
}
// QTBUG-43873
void tst_QQuickListView::sectionsItemInsertion()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
QaimModel model;
for (int i = 0; i < 30; i++)
@@ -2574,7 +2551,7 @@ void tst_QQuickListView::sectionsItemInsertion()
window->setSource(testFileUrl("listview-sections_delegate.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
QTRY_VERIFY(listview != 0);
@@ -2925,10 +2902,10 @@ void tst_QQuickListView::keyNavigation_data()
void tst_QQuickListView::itemList()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("itemlist.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "view");
QTRY_VERIFY(listview != 0);
@@ -2960,16 +2937,14 @@ void tst_QQuickListView::itemList()
text = findItem<QQuickText>(contentItem, "text3");
QTRY_VERIFY(text);
QTRY_COMPARE(text->text(), QLatin1String("index: 2"));
-
- delete window;
}
void tst_QQuickListView::itemListFlicker()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("itemlist-flicker.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "view");
QTRY_VERIFY(listview != 0);
@@ -3009,13 +2984,11 @@ void tst_QQuickListView::itemListFlicker()
QVERIFY(delegateVisible(item));
QVERIFY(item = findItem<QQuickItem>(contentItem, "item3"));
QVERIFY(delegateVisible(item));
-
- delete window;
}
void tst_QQuickListView::cacheBuffer()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
QaimModel model;
for (int i = 0; i < 90; i++)
@@ -3029,7 +3002,7 @@ void tst_QQuickListView::cacheBuffer()
window->setSource(testFileUrl("listviewtest.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
QTRY_VERIFY(listview != 0);
@@ -3114,13 +3087,12 @@ void tst_QQuickListView::cacheBuffer()
listview->setCacheBuffer(-1);
QCOMPARE(listview->cacheBuffer(), 200);
- delete window;
delete testObject;
}
void tst_QQuickListView::positionViewAtBeginningEnd()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
QaimModel model;
for (int i = 0; i < 40; i++)
@@ -3133,7 +3105,7 @@ void tst_QQuickListView::positionViewAtBeginningEnd()
ctxt->setContextProperty("testObject", testObject);
window->show();
window->setSource(testFileUrl("listviewtest.qml"));
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
QTRY_VERIFY(listview != 0);
@@ -3169,7 +3141,6 @@ void tst_QQuickListView::positionViewAtBeginningEnd()
QVERIFY(listview->highlightItem());
QCOMPARE(listview->highlightItem()->y(), 20.);
- delete window;
delete testObject;
}
@@ -3263,7 +3234,7 @@ void tst_QQuickListView::positionViewAtIndex_data()
void tst_QQuickListView::resetModel()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
QStringList strings;
strings << "one" << "two" << "three";
@@ -3274,7 +3245,7 @@ void tst_QQuickListView::resetModel()
window->setSource(testFileUrl("displaylist.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
QTRY_VERIFY(listview != 0);
@@ -3302,14 +3273,11 @@ void tst_QQuickListView::resetModel()
QTRY_VERIFY(display != 0);
QTRY_COMPARE(display->text(), strings.at(i));
}
-
- delete window;
}
void tst_QQuickListView::propertyChanges()
{
- QQuickView *window = createView();
- QTRY_VERIFY(window);
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("propertychangestest.qml"));
QQuickListView *listView = window->rootObject()->findChild<QQuickListView*>("listView");
@@ -3370,14 +3338,11 @@ void tst_QQuickListView::propertyChanges()
QTRY_COMPARE(keyNavigationWrapsSpy.count(),1);
QTRY_COMPARE(cacheBufferSpy.count(),1);
QTRY_COMPARE(snapModeSpy.count(),1);
-
- delete window;
}
void tst_QQuickListView::componentChanges()
{
- QQuickView *window = createView();
- QTRY_VERIFY(window);
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("propertychangestest.qml"));
QQuickListView *listView = window->rootObject()->findChild<QQuickListView*>("listView");
@@ -3418,14 +3383,11 @@ void tst_QQuickListView::componentChanges()
QTRY_COMPARE(delegateSpy.count(),1);
QTRY_COMPARE(headerSpy.count(),1);
QTRY_COMPARE(footerSpy.count(),1);
-
- delete window;
}
void tst_QQuickListView::modelChanges()
{
- QQuickView *window = createView();
- QTRY_VERIFY(window);
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("propertychangestest.qml"));
QQuickListView *listView = window->rootObject()->findChild<QQuickListView*>("listView");
@@ -3445,16 +3407,14 @@ void tst_QQuickListView::modelChanges()
listView->setModel(QVariant());
QTRY_COMPARE(modelSpy.count(),2);
-
- delete window;
}
void tst_QQuickListView::QTBUG_9791()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("strictlyenforcerange.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject());
QTRY_VERIFY(listview != 0);
@@ -3480,8 +3440,6 @@ void tst_QQuickListView::QTBUG_9791()
// check that view is positioned correctly
QTRY_COMPARE(listview->contentX(), 590.0);
-
- delete window;
}
void tst_QQuickListView::manualHighlight()
@@ -3522,8 +3480,7 @@ void tst_QQuickListView::manualHighlight()
void tst_QQuickListView::QTBUG_11105()
{
- QQuickView *window = createView();
-
+ QScopedPointer<QQuickView> window(createView());
QaimModel model;
for (int i = 0; i < 30; i++)
model.addItem("Item" + QString::number(i), "");
@@ -3536,7 +3493,7 @@ void tst_QQuickListView::QTBUG_11105()
window->setSource(testFileUrl("listviewtest.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
QTRY_VERIFY(listview != 0);
@@ -3565,14 +3522,13 @@ void tst_QQuickListView::QTBUG_11105()
itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
QCOMPARE(itemCount, 5);
- delete window;
delete testObject;
}
void tst_QQuickListView::initialZValues()
{
QFETCH(QString, fileName);
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl(fileName));
qApp->processEvents();
@@ -3596,8 +3552,6 @@ void tst_QQuickListView::initialZValues()
QQuickText *sectionItem = 0;
QTRY_VERIFY(sectionItem = findItem<QQuickText>(contentItem, "section"));
QTRY_COMPARE(sectionItem->z(), listview->property("sectionZ").toReal());
-
- delete window;
}
void tst_QQuickListView::initialZValues_data()
@@ -3791,8 +3745,7 @@ void tst_QQuickListView::header_data()
void tst_QQuickListView::header_delayItemCreation()
{
- QQuickView *window = createView();
-
+ QScopedPointer<QQuickView> window(createView());
QaimModel model;
window->rootContext()->setContextProperty("setCurrentToZero", QVariant(false));
@@ -3813,8 +3766,6 @@ void tst_QQuickListView::header_delayItemCreation()
model.clear();
QTRY_COMPARE(header->y(), -header->height());
-
- delete window;
}
void tst_QQuickListView::headerChangesViewport()
@@ -4147,8 +4098,7 @@ void tst_QQuickListView::extents_data()
void tst_QQuickListView::resetModel_headerFooter()
{
// Resetting a model shouldn't crash in views with header/footer
-
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
QaimModel model;
for (int i = 0; i < 4; i++)
@@ -4183,14 +4133,11 @@ void tst_QQuickListView::resetModel_headerFooter()
QQuickItem *newFooter = findItem<QQuickItem>(contentItem, "footer");
QCOMPARE(newFooter, footer);
QCOMPARE(footer->y(), 30.*4);
-
- delete window;
}
void tst_QQuickListView::resizeView()
{
- QQuickView *window = createView();
-
+ QScopedPointer<QQuickView> window(createView());
QaimModel model;
for (int i = 0; i < 40; i++)
model.addItem("Item" + QString::number(i), "");
@@ -4203,7 +4150,7 @@ void tst_QQuickListView::resizeView()
window->setSource(testFileUrl("listviewtest.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
QTRY_VERIFY(listview != 0);
@@ -4263,13 +4210,12 @@ void tst_QQuickListView::resizeView()
QCOMPARE(delegateVisible(item), i < 6); // inside view visible, outside not visible
}
- delete window;
delete testObject;
}
void tst_QQuickListView::resizeViewAndRepaint()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
QaimModel model;
for (int i = 0; i < 40; i++)
@@ -4281,7 +4227,7 @@ void tst_QQuickListView::resizeViewAndRepaint()
window->setSource(testFileUrl("resizeview.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
QTRY_VERIFY(listview != 0);
@@ -4298,13 +4244,11 @@ void tst_QQuickListView::resizeViewAndRepaint()
listview->setHeight(100);
QTRY_VERIFY(!findItem<QQuickItem>(contentItem, "wrapper", 10));
-
- delete window;
}
void tst_QQuickListView::sizeLessThan1()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
QaimModel model;
for (int i = 0; i < 30; i++)
@@ -4318,7 +4262,7 @@ void tst_QQuickListView::sizeLessThan1()
window->setSource(testFileUrl("sizelessthan1.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
QTRY_VERIFY(listview != 0);
@@ -4335,14 +4279,12 @@ void tst_QQuickListView::sizeLessThan1()
QTRY_COMPARE(item->y(), i*0.5);
}
- delete window;
delete testObject;
}
void tst_QQuickListView::QTBUG_14821()
{
- QQuickView *window = createView();
-
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("qtbug14821.qml"));
qApp->processEvents();
@@ -4357,14 +4299,11 @@ void tst_QQuickListView::QTBUG_14821()
listview->incrementCurrentIndex();
QCOMPARE(listview->currentIndex(), 0);
-
- delete window;
}
void tst_QQuickListView::resizeDelegate()
{
- QQuickView *window = createView();
-
+ QScopedPointer<QQuickView> window(createView());
QStringList strings;
for (int i = 0; i < 30; ++i)
strings << QString::number(i);
@@ -4375,7 +4314,7 @@ void tst_QQuickListView::resizeDelegate()
window->setSource(testFileUrl("displaylist.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
QVERIFY(listview != 0);
@@ -4435,16 +4374,13 @@ void tst_QQuickListView::resizeDelegate()
QTRY_COMPARE(listview->currentItem()->y(), 70.0);
QTRY_COMPARE(listview->highlightItem()->y(), 70.0);
-
- delete window;
}
void tst_QQuickListView::resizeFirstDelegate()
{
// QTBUG-20712: Content Y jumps constantly if first delegate height == 0
// and other delegates have height > 0
-
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
// bug only occurs when all items in the model are visible
QaimModel model;
@@ -4459,7 +4395,7 @@ void tst_QQuickListView::resizeFirstDelegate()
window->setSource(testFileUrl("listviewtest.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
QVERIFY(listview != 0);
@@ -4512,7 +4448,6 @@ void tst_QQuickListView::resizeFirstDelegate()
}
delete testObject;
- delete window;
}
void tst_QQuickListView::repositionResizedDelegate()
@@ -4620,11 +4555,11 @@ void tst_QQuickListView::repositionResizedDelegate_data()
void tst_QQuickListView::QTBUG_16037()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->show();
window->setSource(testFileUrl("qtbug16037.qml"));
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "listview");
QTRY_VERIFY(listview != 0);
@@ -4634,8 +4569,6 @@ void tst_QQuickListView::QTBUG_16037()
QMetaObject::invokeMethod(window->rootObject(), "setModel");
QTRY_COMPARE(listview->contentHeight(), 80.0);
-
- delete window;
}
void tst_QQuickListView::indexAt_itemAt_data()
@@ -4694,7 +4627,7 @@ void tst_QQuickListView::indexAt_itemAt()
void tst_QQuickListView::incrementalModel()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
QSKIP("QTBUG-30716");
IncrementalModel model;
@@ -4718,8 +4651,6 @@ void tst_QQuickListView::incrementalModel()
listview->forceLayout();
QTRY_COMPARE(listview->count(), 25);
-
- delete window;
}
void tst_QQuickListView::onAdd()
@@ -4734,7 +4665,7 @@ void tst_QQuickListView::onAdd()
for (int i=0; i<initialItemCount; i++)
model.addItem("dummy value", "dummy value");
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->setGeometry(0,0,200, delegateHeight * (initialItemCount + itemsToAdd));
QQmlContext *ctxt = window->rootContext();
ctxt->setContextProperty("testModel", &model);
@@ -4757,8 +4688,6 @@ void tst_QQuickListView::onAdd()
QCOMPARE(result.count(), items.count());
for (int i=0; i<items.count(); i++)
QCOMPARE(result[i].toString(), items[i].first);
-
- delete window;
}
void tst_QQuickListView::onAdd_data()
@@ -4832,11 +4761,11 @@ void tst_QQuickListView::onRemove_data()
void tst_QQuickListView::rightToLeft()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->setGeometry(0,0,640,320);
window->setSource(testFileUrl("rightToLeft.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QVERIFY(window->rootObject() != 0);
QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "view");
@@ -4880,18 +4809,16 @@ void tst_QQuickListView::rightToLeft()
// Ensure resizing maintains position relative to right edge
qobject_cast<QQuickItem*>(window->rootObject())->setWidth(600);
QTRY_COMPARE(listview->contentX(), -600.);
-
- delete window;
}
void tst_QQuickListView::test_mirroring()
{
- QQuickView *windowA = createView();
+ QScopedPointer<QQuickView> windowA(createView());
windowA->setSource(testFileUrl("rightToLeft.qml"));
QQuickListView *listviewA = findItem<QQuickListView>(windowA->rootObject(), "view");
QTRY_VERIFY(listviewA != 0);
- QQuickView *windowB = createView();
+ QScopedPointer<QQuickView> windowB(createView());
windowB->setSource(testFileUrl("rightToLeft.qml"));
QQuickListView *listviewB = findItem<QQuickListView>(windowB->rootObject(), "view");
QTRY_VERIFY(listviewA != 0);
@@ -4940,15 +4867,11 @@ void tst_QQuickListView::test_mirroring()
// LTR == RTL+mirror
foreach (const QString objectName, objectNames)
QCOMPARE(findItem<QQuickItem>(listviewA, objectName)->x(), findItem<QQuickItem>(listviewB, objectName)->x());
-
- delete windowA;
- delete windowB;
}
void tst_QQuickListView::margins()
{
- QQuickView *window = createView();
-
+ QScopedPointer<QQuickView> window(createView());
QaimModel model;
for (int i = 0; i < 50; i++)
model.addItem("Item" + QString::number(i), "");
@@ -4958,7 +4881,7 @@ void tst_QQuickListView::margins()
window->setSource(testFileUrl("margins.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
QTRY_VERIFY(listview != 0);
@@ -5006,8 +4929,6 @@ void tst_QQuickListView::margins()
listview->setBottomMargin(40);
QCOMPARE(listview->originY(), 20.);
QTRY_COMPARE(listview->contentY(), pos-10);
-
- delete window;
}
// QTBUG-24028
@@ -5223,14 +5144,14 @@ void tst_QQuickListView::snapToItem()
void tst_QQuickListView::snapOneItemResize_QTBUG_43555()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->resize(QSize(100, 320));
window->setResizeMode(QQuickView::SizeRootObjectToView);
- QQuickViewTestUtil::moveMouseAway(window);
+ QQuickViewTestUtil::moveMouseAway(window.data());
window->setSource(testFileUrl("snapOneItemResize.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject());
QTRY_VERIFY(listview != 0);
@@ -5248,8 +5169,6 @@ void tst_QQuickListView::snapOneItemResize_QTBUG_43555()
QTRY_COMPARE(listview->currentIndex(), 5);
QCOMPARE(currentIndexSpy.count(), 0);
-
- delete window;
}
void tst_QQuickListView::qAbstractItemModel_package_items()
@@ -5425,7 +5344,7 @@ void tst_QQuickListView::QTBUG_21742()
void tst_QQuickListView::asynchronous()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->show();
QQmlIncubationController controller;
window->engine()->setIncubationController(&controller);
@@ -5464,8 +5383,6 @@ void tst_QQuickListView::asynchronous()
QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
QTRY_COMPARE(item->y(), i*50.0);
}
-
- delete window;
}
void tst_QQuickListView::snapOneItem_data()
@@ -5601,11 +5518,10 @@ void tst_QQuickListView::snapOneItem()
void tst_QQuickListView::snapOneItemCurrentIndexRemoveAnimation()
{
- QQuickView *window = createView();
-
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("snapOneItemCurrentIndexRemoveAnimation.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject());
QTRY_VERIFY(listview != 0);
@@ -5621,14 +5537,11 @@ void tst_QQuickListView::snapOneItemCurrentIndexRemoveAnimation()
QCOMPARE(listview->currentIndex(), 0);
QCOMPARE(currentIndexSpy.count(), 0);
-
- delete window;
}
void tst_QQuickListView::attachedProperties_QTBUG_32836()
{
- QQuickView *window = createView();
-
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("attachedProperties.qml"));
window->show();
qApp->processEvents();
@@ -5655,8 +5568,6 @@ void tst_QQuickListView::attachedProperties_QTBUG_32836()
QQuickItem *sectionItem = findItem<QQuickItem>(window->rootObject(), "sectionItem");
QVERIFY(sectionItem);
QCOMPARE(sectionItem->width(), listview->width());
-
- delete window;
}
void tst_QQuickListView::unrequestedVisibility()
@@ -7112,12 +7023,12 @@ void tst_QQuickListView::matchItemLists(const QVariantList &itemLists, const QLi
void tst_QQuickListView::flickBeyondBounds()
{
- QQuickView *window = createView();
- QQuickViewTestUtil::moveMouseAway(window);
+ QScopedPointer<QQuickView> window(createView());
+ QQuickViewTestUtil::moveMouseAway(window.data());
window->setSource(testFileUrl("flickBeyondBoundsBug.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
@@ -7128,7 +7039,7 @@ void tst_QQuickListView::flickBeyondBounds()
QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
// Flick view up beyond bounds
- flick(window, QPoint(10, 10), QPoint(10, -2000), 180);
+ flick(window.data(), QPoint(10, 10), QPoint(10, -2000), 180);
#ifdef Q_OS_MAC
QSKIP("Disabled due to flaky behavior on CI system (QTBUG-44493)");
QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper").count(), 0);
@@ -7143,19 +7054,17 @@ void tst_QQuickListView::flickBeyondBounds()
QTRY_VERIFY(item);
QTRY_COMPARE(item->y(), qreal(i*45));
}
-
- delete window;
}
void tst_QQuickListView::destroyItemOnCreation()
{
QaimModel model;
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->rootContext()->setContextProperty("testModel", &model);
window->setSource(testFileUrl("destroyItemOnCreation.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
@@ -7171,19 +7080,16 @@ void tst_QQuickListView::destroyItemOnCreation()
QTRY_COMPARE(findItems<QQuickItem>(contentItem, "wrapper").count(), 0);
QCOMPARE(model.count(), 0);
-
- delete window;
}
void tst_QQuickListView::parentBinding()
{
- QQuickView *window = createView();
-
+ QScopedPointer<QQuickView> window(createView());
QQmlTestMessageHandler messageHandler;
window->setSource(testFileUrl("parentBinding.qml"));
window->show();
- QTest::qWaitForWindowExposed(window);
+ QTest::qWaitForWindowExposed(window.data());
QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject());
QVERIFY(listview != 0);
@@ -7199,8 +7105,6 @@ void tst_QQuickListView::parentBinding()
// there should be no transient binding error
QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString()));
-
- delete window;
}
void tst_QQuickListView::defaultHighlightMoveDuration()
@@ -7217,7 +7121,7 @@ void tst_QQuickListView::defaultHighlightMoveDuration()
void tst_QQuickListView::accessEmptyCurrentItem_QTBUG_30227()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("emptymodel.qml"));
QQuickListView *listview = window->rootObject()->findChild<QQuickListView*>();
@@ -7233,7 +7137,7 @@ void tst_QQuickListView::accessEmptyCurrentItem_QTBUG_30227()
void tst_QQuickListView::delayedChanges_QTBUG_30555()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("delayedChanges.qml"));
QQuickListView *listview = window->rootObject()->findChild<QQuickListView*>();
@@ -7247,21 +7151,19 @@ void tst_QQuickListView::delayedChanges_QTBUG_30555()
QMetaObject::invokeMethod(window->rootObject(), "takeTwo_sync");
QCOMPARE(listview->count(), 6);
-
- delete window;
}
void tst_QQuickListView::outsideViewportChangeNotAffectingView()
{
- QQuickView *window = createView();
- QQuickViewTestUtil::moveMouseAway(window);
+ QScopedPointer<QQuickView> window(createView());
+ QQuickViewTestUtil::moveMouseAway(window.data());
window->setSource(testFileUrl("outsideViewportChangeNotAffectingView.qml"));
QQuickListView *listview = window->rootObject()->findChild<QQuickListView*>();
QTRY_VERIFY(listview != 0);
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
listview->setContentY(1250);
@@ -7283,25 +7185,21 @@ void tst_QQuickListView::outsideViewportChangeNotAffectingView()
QMetaObject::invokeMethod(window->rootObject(), "resizeThirdItem", Q_ARG(QVariant, 400));
QTRY_COMPARE(listview->indexAt(0, listview->contentY()), 4);
QTRY_COMPARE(listview->itemAt(0, listview->contentY())->y(), 1200.);
-
- delete window;
}
void tst_QQuickListView::testProxyModelChangedAfterMove()
{
- QQuickView *window = createView();
- QQuickViewTestUtil::moveMouseAway(window);
+ QScopedPointer<QQuickView> window(createView());
+ QQuickViewTestUtil::moveMouseAway(window.data());
window->setSource(testFileUrl("proxytest.qml"));
QQuickListView *listview = window->rootObject()->findChild<QQuickListView*>();
QTRY_VERIFY(listview != 0);
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QTRY_COMPARE(listview->count(), 3);
-
- delete window;
}
void tst_QQuickListView::typedModel()
@@ -7324,10 +7222,10 @@ void tst_QQuickListView::typedModel()
void tst_QQuickListView::displayMargin()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("displayMargin.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QQuickListView *listview = window->rootObject()->findChild<QQuickListView*>();
QVERIFY(listview != 0);
@@ -7355,17 +7253,15 @@ void tst_QQuickListView::displayMargin()
// the first delegate should now be outside the begin margin
listview->positionViewAtIndex(4, QQuickListView::Beginning);
QCOMPARE(delegateVisible(item0), false);
-
- delete window;
}
void tst_QQuickListView::negativeDisplayMargin()
{
QQuickItem *item;
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("negativeDisplayMargin.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QQuickItem *listview = window->rootObject();
QQuickListView *innerList = findItem<QQuickListView>(window->rootObject(), "innerList");
@@ -7398,8 +7294,6 @@ void tst_QQuickListView::negativeDisplayMargin()
listview->setProperty("contentY", 0);
QTRY_VERIFY(item = findItem<QQuickItem>(content, "delegate", 4));
QTRY_COMPARE(delegateVisible(item), true);
-
- delete window;
}
void tst_QQuickListView::highlightItemGeometryChanges()
@@ -8242,10 +8136,10 @@ void tst_QQuickListView::contentHeightWithDelayRemove()
QFETCH(int, countDelta);
QFETCH(qreal, contentHeightDelta);
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("contentHeightWithDelayRemove.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QQuickListView *listview = window->rootObject()->findChild<QQuickListView*>();
QTRY_VERIFY(listview != 0);
@@ -8267,32 +8161,30 @@ void tst_QQuickListView::contentHeightWithDelayRemove()
} else {
QCOMPARE(qRound(listview->contentHeight()), eventualContentHeight);
}
-
- delete window;
}
void tst_QQuickListView::QTBUG_48044_currentItemNotVisibleAfterTransition()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("qtbug48044.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QQuickListView *listview = window->rootObject()->findChild<QQuickListView*>();
QTRY_VERIFY(listview != 0);
// Expand 2nd header
listview->setProperty("transitionsDone", QVariant(false));
- QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, QPoint(window->width() / 2, 75));
+ QTest::mouseClick(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(window->width() / 2, 75));
QTRY_VERIFY(listview->property("transitionsDone").toBool());
// Flick listview to the bottom
- flick(window, QPoint(window->width() / 2, 400), QPoint(window->width() / 2, 0), 100);
+ flick(window.data(), QPoint(window->width() / 2, 400), QPoint(window->width() / 2, 0), 100);
QTRY_VERIFY(!listview->isMoving());
// Expand 3rd header
listview->setProperty("transitionsDone", QVariant(false));
- QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, QPoint(window->width() / 2, window->height() - 25));
+ QTest::mouseClick(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(window->width() / 2, window->height() - 25));
QTRY_VERIFY(listview->property("transitionsDone").toBool());
// Check current item is what we expect
@@ -8466,15 +8358,13 @@ void tst_QQuickListView::QTBUG_48870_fastModelUpdates()
{
QTBUG_48870_Model model;
- QQuickView *window = createView();
- QVERIFY(window);
+ QScopedPointer<QQuickView> window(createView());
QQmlContext *ctxt = window->rootContext();
- QVERIFY(ctxt);
ctxt->setContextProperty("testModel", &model);
window->setSource(testFileUrl("qtbug48870.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list");
QTRY_VERIFY(listview != 0);
@@ -8493,13 +8383,11 @@ void tst_QQuickListView::QTBUG_48870_fastModelUpdates()
: QString("Found index %1, expected index is %3").arg(item->index).arg(expectedIdx)));
if (i % 3 != 0) {
if (i & 1)
- flick(window, QPoint(100, 200), QPoint(100, 0), 100);
+ flick(window.data(), QPoint(100, 200), QPoint(100, 0), 100);
else
- flick(window, QPoint(100, 200), QPoint(100, 400), 100);
+ flick(window.data(), QPoint(100, 200), QPoint(100, 400), 100);
}
}
-
- delete window;
}
// infinite loop in overlay header positioning due to undesired rounding in QQuickFlickablePrivate::fixup()
@@ -8516,10 +8404,10 @@ void tst_QQuickListView::QTBUG_50105()
void tst_QQuickListView::QTBUG_50097_stickyHeader_positionViewAtIndex()
{
- QQuickView *window = createView();
+ QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("qtbug50097.qml"));
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject());
QVERIFY(listview != 0);
diff --git a/tools/qmlimportscanner/main.cpp b/tools/qmlimportscanner/main.cpp
index 736816f769..af6b272fc6 100644
--- a/tools/qmlimportscanner/main.cpp
+++ b/tools/qmlimportscanner/main.cpp
@@ -339,6 +339,24 @@ QVariantList mergeImports(const QVariantList &a, const QVariantList &b)
return merged;
}
+// Predicates needed by findQmlImportsInDirectory.
+
+struct isMetainfo {
+ bool operator() (const QFileInfo &x) const {
+ return x.suffix() == QLatin1String("metainfo");
+ }
+};
+
+struct pathStartsWith {
+ pathStartsWith(const QString &path) : _path(path) {}
+ bool operator() (const QString &x) const {
+ return _path.startsWith(x);
+ }
+ const QString _path;
+};
+
+
+
// Scan all qml files in directory for import statements
QVariantList findQmlImportsInDirectory(const QString &qmlDir)
{
@@ -348,19 +366,6 @@ QVariantList findQmlImportsInDirectory(const QString &qmlDir)
QDirIterator iterator(qmlDir, QDir::AllDirs | QDir::NoDotDot, QDirIterator::Subdirectories);
QStringList blacklist;
- struct isMetainfo {
- bool operator() (const QFileInfo &x) const {
- return x.suffix() == QLatin1String("metainfo");
- }
- };
- struct pathStartsWith {
- pathStartsWith(const QString &path) : _path(path) {}
- bool operator() (const QString &x) const {
- return _path.startsWith(x);
- }
- const QString _path;
- };
-
while (iterator.hasNext()) {
iterator.next();