diff options
author | Richard Dale <richard.dale@codethink.co.uk> | 2013-07-04 09:56:26 +0100 |
---|---|---|
committer | Richard Dale <richard.dale@codethink.co.uk> | 2013-07-04 09:56:26 +0100 |
commit | 774d0310883a9526210c4530bbb9d0af26d88699 (patch) | |
tree | d79e075f964ef213a31ee290c00d9438f3b139dc | |
parent | 9b3d0a24b65f6a0725951a4df0239ef19a8d3f64 (diff) | |
parent | 811337a73c160447e5218ae55e93df99ac3d9edd (diff) | |
download | qtdeclarative-774d0310883a9526210c4530bbb9d0af26d88699.tar.gz |
Merge v5.1.0 releasebaserock/morph
142 files changed, 2679 insertions, 779 deletions
diff --git a/dist/changes-5.1.0 b/dist/changes-5.1.0 index 50bdc2f9f8..141c9a90e1 100644 --- a/dist/changes-5.1.0 +++ b/dist/changes-5.1.0 @@ -21,7 +21,12 @@ information about a particular change. General Improvements -------------------- - +- The Qt.application object in QML has gained the following new members + * arguments property, containing any command line arguments of the application + * name property, containing the string of the application name + * version property, containing the string of the application version + * aboutToQuit() signal, allowing last-minute cleanup +- New Qt.platform.os property exposes the current platform. Third party components ---------------------- @@ -42,12 +47,55 @@ Third party components - As part of a fix for QTBUG-30555, ListView and GridView properties, such as count, which are based off of the data model will no longer update immediately if queried. Updates are batched to happen once per frame (or - when properties are being set). + when properties are being set). You may manually update using the + forceLayout() method, new in QtQuick 2.1. + + - For QML tests, tryCompare now correctly fails when it only gets two parameters + + - If a QObject has a property and a slot (or invokable method) with the same + name, in QML the previous behavior was to let the property obscure the + method; from Qt 5.1 things work in the opposite way, that is a property can + never obscure a method having the same name. This is especially important + for objects having dynamic properties, such as QQmlPropertyMap. This change + was a consequence of the fix for QTBUG-29836. + + - The 'with' statement has been deprecated in the QML language. Using this + statement now produces a deprecation warning, and future versions of the + QML engine may not recognize it. + + - The implicit import is now only loaded for QML files if there are + unresolved types after loading all explicit imports. Applications where + the implicit import triggered code other than the registration of types + will now need to add import "." to their QML files. + **************************************************************************** * Library * **************************************************************************** +QtQml +------ + - New QML import version QtQml.Models 2.1 contains generic versions of the VisualModel + types. These new generic versions work with any QObject based delegate, + not just QQuickItem based delegates. + - New module version QtQml 2.1 provides the new Instantiator type, which + is a generic version of Repeater which works with any QObject based + delegate, not just QQuickItem based delegates. + - New convenience class QQmlApplicationEngine automatically provides + functionality common in the C++ shell of a primarily QML application. + - New qmlClearTypeRegistrations() function in qqml.h. This function drops all + static data generated by previous qmlRegisterType calls. + - New qmlRegisteredType function in qqml.h, allowing the registration of + composite types from C++. + - New baseUrl() accessor in QQmlExtensionPlugin, in case a plugin + needs to load QML or other assets from the same directory. + +QtQuick +------ + - New QML import version QtQuick 2.1 contains no new types, but adds new + properties, methods and signals to existing types. See the release notes + in the QtQuick documentation for details. - QTBUG-30837: The Flickable type no longer fixes up the content area on startup to move it inside the viewport. + - QTBUG-28086: Remote image URLs now work as a source for AnimatedSprite **************************************************************************** @@ -58,7 +106,11 @@ Third party components **************************************************************************** * Platform Specific Changes * **************************************************************************** - + - New threaded render loop for Mac and Linux should lead to improved + graphical performance of QtQuick 2 on those platforms. + - New render loop on Windows should lead to smoother animations. + - assets: scheme supported on Android for urls inside QML + - Mac: "@2x" images are now loaded on "retina" systems. **************************************************************************** * Compiler Specific Changes * @@ -69,9 +121,23 @@ Third party components * Tools * **************************************************************************** +- qmlplugindump gains a -relocatable flag. **************************************************************************** * Plugins * **************************************************************************** +- New QML import QtQuick.Dialogs 1.0 contains types for more easily adding + dialogs to an application. Initially comes with FileDialog and ColorDialog + +- New QML import version QtQuick.Window 2.1 adds many new properties to both + the Screen and Window types. See the release notes in the QtQuick + documentation for further details. + +- QTBUG-30915: Animating emitRate on Emitter no longer fails for specific + animation timings. As a side effect, when emitting infinite particles + changing the particle count will no longer have an effect after initial + emission (previously it no longer had an effect after a certain point + into the animation). + diff --git a/examples/quick/customitems/painteditem/painteditem.pro b/examples/quick/customitems/painteditem/painteditem.pro index 77e4d146e1..3ec6420abf 100644 --- a/examples/quick/customitems/painteditem/painteditem.pro +++ b/examples/quick/customitems/painteditem/painteditem.pro @@ -18,3 +18,6 @@ qmldir.files = TextBalloonPlugin/qmldir qmldir.path = $$[QT_INSTALL_EXAMPLES]/quick/customitems/painteditem/TextBalloonPlugin INSTALLS += qmldir target + +OTHER_FILES += \ + textballoons.qml diff --git a/examples/quick/demos/calqlatr/calqlatr.pro b/examples/quick/demos/calqlatr/calqlatr.pro index 1b002a5f27..91d52a293e 100644 --- a/examples/quick/demos/calqlatr/calqlatr.pro +++ b/examples/quick/demos/calqlatr/calqlatr.pro @@ -6,5 +6,24 @@ SOURCES += main.cpp RESOURCES += calqlatr.qrc \ ../../shared/shared.qrc +OTHER_FILES = calqlatr.qml \ + content/Button.qml \ + content/Display.qml \ + content/NumberPad.qml \ + content/StyleLabel.qml \ + content/audio/touch.wav \ + content/calculator.js \ + content/images/icon-back.png \ + content/images/icon-close.png \ + content/images/icon-settings.png \ + content/images/logo.png \ + content/images/paper-edge-left.png \ + content/images/paper-edge-right.png \ + content/images/paper-grip.png \ + content/images/settings-selected-a.png \ + content/images/settings-selected-b.png \ + content/images/touch-green.png \ + content/images/touch-white.png + target.path = $$[QT_INSTALL_EXAMPLES]/quick/demos/calqlatr INSTALLS += target diff --git a/examples/quick/demos/calqlatr/calqlatr.qml b/examples/quick/demos/calqlatr/calqlatr.qml index 16b2e19724..0a092c25da 100644 --- a/examples/quick/demos/calqlatr/calqlatr.qml +++ b/examples/quick/demos/calqlatr/calqlatr.qml @@ -57,7 +57,7 @@ Rectangle { Item { id: pad - width: window.width * 0.58 + width: 180 NumberPad { y: 10; anchors.horizontalCenter: parent.horizontalCenter } } @@ -77,7 +77,7 @@ Rectangle { Display { id: display x: -16 - width: window.width * 0.42 + width: window.width - pad.width height: parent.height MouseArea { @@ -85,7 +85,12 @@ Rectangle { property real oldP: 0 property bool rewind: false - anchors.fill: parent + anchors { + bottom: parent.bottom + left: parent.left + right: parent.right + } + height: 50 onPositionChanged: { var reverse = startX > window.width / 2 var mx = mapToItem(window, mouse.x).x diff --git a/examples/quick/demos/calqlatr/content/Display.qml b/examples/quick/demos/calqlatr/content/Display.qml index 4a78a3ebcd..ec8edfea66 100644 --- a/examples/quick/demos/calqlatr/content/Display.qml +++ b/examples/quick/demos/calqlatr/content/Display.qml @@ -42,23 +42,38 @@ import QtQuick 2.0 Item { id: display + property bool enteringDigits: false function displayOperator(operator) { listView.model.append({ "operator": operator, "operand": "" }) + enteringDigits = true } function newLine(operator, operand) { listView.model.append({ "operator": operator, "operand": operand }) + enteringDigits = false + listView.positionViewAtEnd() } function appendDigit(digit) { - if (!listView.model.count) + if (!enteringDigits) listView.model.append({ "operator": "", "operand": "" }) var i = listView.model.count - 1; listView.model.get(i).operand = listView.model.get(i).operand + digit; + enteringDigits = true + } + + function clear() + { + if (enteringDigits) { + var i = listView.model.count - 1 + if (i >= 0) + listView.model.remove(i) + enteringDigits = false + } } Item { @@ -87,6 +102,7 @@ Item { } Image { + id: grip source: "images/paper-grip.png" anchors.horizontalCenter: parent.horizontalCenter anchors.bottom: parent.bottom @@ -97,7 +113,7 @@ Item { id: listView x: 16; y: 30 width: display.width - height: display.height + height: display.height - 50 - y delegate: Item { height: 20 width: parent.width diff --git a/examples/quick/demos/calqlatr/content/NumberPad.qml b/examples/quick/demos/calqlatr/content/NumberPad.qml index 3203e18431..c7f2680651 100644 --- a/examples/quick/demos/calqlatr/content/NumberPad.qml +++ b/examples/quick/demos/calqlatr/content/NumberPad.qml @@ -60,7 +60,7 @@ Grid { Button { text: "±"; color: "#6da43d"; operator: true } Button { text: "−"; color: "#6da43d"; operator: true } Button { text: "+"; color: "#6da43d"; operator: true } - Button { text: " "; color: "#6da43d"; operator: true } + Button { text: "√"; color: "#6da43d"; operator: true } Button { text: "÷"; color: "#6da43d"; operator: true } Button { text: "×"; color: "#6da43d"; operator: true } Button { text: "C"; color: "#6da43d"; operator: true } diff --git a/examples/quick/demos/calqlatr/content/calculator.js b/examples/quick/demos/calqlatr/content/calculator.js index d86fecbf39..da8e940b16 100644 --- a/examples/quick/demos/calqlatr/content/calculator.js +++ b/examples/quick/demos/calqlatr/content/calculator.js @@ -84,7 +84,7 @@ function operatorPressed(op) } else if (previousOperator == "×") { digits = Number(curVal) * Number(digits.valueOf()) } else if (previousOperator == "÷") { - digits = Number(Number(curVal) / Number(digits.valueOf())).toString() + digits = Number(curVal) / Number(digits.valueOf()) } else if (previousOperator == "=") { } @@ -110,9 +110,9 @@ function operatorPressed(op) digits = (Math.abs(digits.valueOf())).toString() } else if (op == "Int") { digits = (Math.floor(digits.valueOf())).toString() - } else if (op == window.plusminus) { + } else if (op == "±") { digits = (digits.valueOf() * -1).toString() - } else if (op == window.squareRoot) { + } else if (op == "√") { digits = (Math.sqrt(digits.valueOf())).toString() } else if (op == "mc") { memory = 0; @@ -130,7 +130,7 @@ function operatorPressed(op) } else if (op == "Off") { Qt.quit(); } else if (op == "C") { - digits = "0" + display.clear() } else if (op == "AC") { curVal = 0 memory = 0 diff --git a/examples/quick/demos/demos.pro b/examples/quick/demos/demos.pro index 67128a905f..867dfa5a07 100644 --- a/examples/quick/demos/demos.pro +++ b/examples/quick/demos/demos.pro @@ -3,10 +3,10 @@ SUBDIRS = samegame \ calqlatr \ tweetsearch \ maroon \ + photosurface \ stocqt EXAMPLE_FILES = \ clocks \ photoviewer \ - photosurface \ rssnews diff --git a/examples/quick/demos/photosurface/main.cpp b/examples/quick/demos/photosurface/main.cpp new file mode 100644 index 0000000000..90d6454211 --- /dev/null +++ b/examples/quick/demos/photosurface/main.cpp @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifdef QT_WIDGETS_LIB +#include <QtWidgets/QApplication> +#else +#include <QtGui/QGuiApplication> +#endif +#include <QtQml/QQmlApplicationEngine> +#include <QtQuick/QQuickWindow> +#include <QtCore/QUrl> + +int main(int argc, char* argv[]) +{ + // The reason to use QApplication is that QWidget-based dialogs + // are the native dialogs on Qt-based platforms like KDE, + // but they cannot be instantiated if this is a QGuiApplication. +#ifdef QT_WIDGETS_LIB + QApplication app(argc, argv); +#else + QGuiApplication app(argc, argv); +#endif + QQuickWindow::setDefaultAlphaBuffer(true); + QQmlApplicationEngine engine(QUrl("qrc:///photosurface.qml")); + return app.exec(); +} diff --git a/examples/quick/demos/photosurface/photosurface.pro b/examples/quick/demos/photosurface/photosurface.pro new file mode 100644 index 0000000000..5e5b0f0815 --- /dev/null +++ b/examples/quick/demos/photosurface/photosurface.pro @@ -0,0 +1,13 @@ +TEMPLATE = app + +QT += qml quick +qtHaveModule(widgets): QT += widgets +SOURCES += main.cpp +RESOURCES += photosurface.qrc + +target.path = $$[QT_INSTALL_EXAMPLES]/quick/demos/photosurface +INSTALLS += target +ICON = resources/icon.png +macx: ICON = resources/photosurface.icns +win32: RC_FILE = resources/photosurface.rc + diff --git a/examples/quick/demos/photosurface/photosurface.qml b/examples/quick/demos/photosurface/photosurface.qml index 53e0edffbe..9d081de1e3 100644 --- a/examples/quick/demos/photosurface/photosurface.qml +++ b/examples/quick/demos/photosurface/photosurface.qml @@ -39,13 +39,14 @@ ****************************************************************************/ import QtQuick 2.0 import QtQuick.Dialogs 1.0 +import QtQuick.Window 2.1 import Qt.labs.folderlistmodel 1.0 -Rectangle { +Window { id: root + visible: true width: 1024; height: 600 color: "black" - visible: true property int highestZ: 0 property real defaultSize: 200 @@ -117,11 +118,27 @@ Rectangle { } } } + + Image { + anchors.top: parent.top + anchors.left: parent.left + anchors.margins: 10 + source: "resources/folder.png" + MouseArea { + anchors.fill: parent + anchors.margins: -10 + onClicked: fileDialog.open() + } + } + Text { anchors.bottom: parent.bottom anchors.left: parent.left + anchors.right: parent.right anchors.margins: 10 color: "darkgrey" + wrapMode: Text.WordWrap + font.pointSize: 8 text: "On a touchscreen: use two fingers to zoom and rotate, one finger to drag\n" + "With a mouse: drag normally, use the vertical wheel to zoom, horizontal wheel to rotate, or hold Ctrl while using the vertical wheel to rotate" } diff --git a/examples/quick/demos/photosurface/photosurface.qrc b/examples/quick/demos/photosurface/photosurface.qrc new file mode 100644 index 0000000000..f8fafbb1ff --- /dev/null +++ b/examples/quick/demos/photosurface/photosurface.qrc @@ -0,0 +1,6 @@ +<RCC> + <qresource prefix="/"> + <file>photosurface.qml</file> + <file>resources/folder.png</file> + </qresource> +</RCC> diff --git a/examples/quick/demos/photosurface/resources/folder.png b/examples/quick/demos/photosurface/resources/folder.png Binary files differnew file mode 100644 index 0000000000..2aec3b6ebf --- /dev/null +++ b/examples/quick/demos/photosurface/resources/folder.png diff --git a/examples/quick/demos/photosurface/resources/icon.png b/examples/quick/demos/photosurface/resources/icon.png Binary files differnew file mode 100644 index 0000000000..f8ff553fcb --- /dev/null +++ b/examples/quick/demos/photosurface/resources/icon.png diff --git a/examples/quick/demos/photosurface/resources/photosurface.icns b/examples/quick/demos/photosurface/resources/photosurface.icns Binary files differnew file mode 100644 index 0000000000..c69ec41c4e --- /dev/null +++ b/examples/quick/demos/photosurface/resources/photosurface.icns diff --git a/examples/quick/demos/photosurface/resources/photosurface.ico b/examples/quick/demos/photosurface/resources/photosurface.ico Binary files differnew file mode 100644 index 0000000000..03bb7ee367 --- /dev/null +++ b/examples/quick/demos/photosurface/resources/photosurface.ico diff --git a/examples/quick/demos/photosurface/resources/photosurface.rc b/examples/quick/demos/photosurface/resources/photosurface.rc new file mode 100644 index 0000000000..ec18eb1cfc --- /dev/null +++ b/examples/quick/demos/photosurface/resources/photosurface.rc @@ -0,0 +1,32 @@ +#include "winver.h" + +IDI_ICON1 ICON DISCARDABLE "photosurface.ico" + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,0 + PRODUCTVERSION 1,0,0,0 + FILEFLAGS 0x0L + FILEFLAGSMASK 0x3fL + FILEOS 0x00040004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "000004b0" + BEGIN + VALUE "CompanyName", "Digia Plc and/or its subsidiary(-ies)" + VALUE "FileDescription", "Photo Surface Demo" + VALUE "FileVersion", "1.0.0.0" + VALUE "LegalCopyright", "Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies)." + VALUE "InternalName", "photosurface" + VALUE "OriginalFilename", "photosurface.exe" + VALUE "ProductName", "Photo Surface Demo" + VALUE "ProductVersion", "1.0.0.0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0, 1200 + END +END diff --git a/examples/quick/dialogs/dialogs.pro b/examples/quick/dialogs/dialogs.pro new file mode 100644 index 0000000000..538e75686c --- /dev/null +++ b/examples/quick/dialogs/dialogs.pro @@ -0,0 +1,4 @@ +TEMPLATE = subdirs + +SUBDIRS = \ + systemdialogs diff --git a/examples/quick/dialogs/ColorDialogs.qml b/examples/quick/dialogs/systemdialogs/ColorDialogs.qml index 7817c8edf8..6a0af7f730 100644 --- a/examples/quick/dialogs/ColorDialogs.qml +++ b/examples/quick/dialogs/systemdialogs/ColorDialogs.qml @@ -46,9 +46,10 @@ Rectangle { width: 320 height: 200 color: palette.window - SystemPalette { id: palette } + clip: true + //! [colordialog] ColorDialog { id: colorDialog visible: colorDialogVisible.checked @@ -59,10 +60,11 @@ Rectangle { onAccepted: { console.log("Accepted: " + color) } onRejected: { console.log("Rejected") } } + //! [colordialog] Column { anchors.fill: parent - anchors.margins: 8 + anchors.margins: 12 spacing: 8 Text { font.bold: true @@ -106,4 +108,38 @@ Rectangle { } } } + + Rectangle { + anchors { + left: parent.left + right: parent.right + bottom: parent.bottom + } + height: 50 + color: Qt.darker(palette.window, 1.1) + border.color: Qt.darker(palette.window, 1.3) + Row { + spacing: 6 + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 12 + height: parent.height - 6 + width: parent.width + Button { + text: "Open" + anchors.verticalCenter: parent.verticalCenter + onClicked: colorDialog.open() + } + Button { + text: "Close" + anchors.verticalCenter: parent.verticalCenter + onClicked: colorDialog.close() + } + Button { + text: "set to green" + anchors.verticalCenter: parent.verticalCenter + onClicked: colorDialog.color = "green" + } + } + } } diff --git a/examples/quick/dialogs/FileDialogs.qml b/examples/quick/dialogs/systemdialogs/FileDialogs.qml index a6df29bb37..4a218853ef 100644 --- a/examples/quick/dialogs/FileDialogs.qml +++ b/examples/quick/dialogs/systemdialogs/FileDialogs.qml @@ -43,44 +43,13 @@ import QtQuick.Dialogs 1.0 import "../shared" Rectangle { - width: 580 - height: 360 + height: 400 color: palette.window SystemPalette { id: palette } + clip: true - Rectangle { - id: toolbar - width: parent.width - height: 40 - color: Qt.darker(palette.window, 1.1) - border.color: Qt.darker(palette.window, 1.3) - Row { - spacing: 6 - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: 8 - height: parent.height - 6 - width: parent.width - Button { - text: "Open" - anchors.verticalCenter: parent.verticalCenter - onClicked: fileDialog.open() - } - Button { - text: "Close" - anchors.verticalCenter: parent.verticalCenter - onClicked: fileDialog.close() - } - Button { - text: "/tmp" - anchors.verticalCenter: parent.verticalCenter - // TODO: QTBUG-29814 This isn't portable, but we don't expose QDir::tempPath to QML yet. - onClicked: fileDialog.folder = "/tmp" - } - } - } - + //! [filedialog] FileDialog { id: fileDialog visible: fileDialogVisible.checked @@ -95,12 +64,11 @@ Rectangle { onAccepted: { console.log("Accepted: " + fileUrls) } onRejected: { console.log("Rejected") } } + //! [filedialog] Column { - anchors.left: parent.left - anchors.right: parent.right - anchors.top: toolbar.bottom - anchors.margins: 8 + anchors.fill: parent + anchors.margins: 12 spacing: 8 Text { color: palette.windowText @@ -163,4 +131,39 @@ Rectangle { wrapMode: Text.Wrap } } + + Rectangle { + anchors { + left: parent.left + right: parent.right + bottom: parent.bottom + } + height: 50 + color: Qt.darker(palette.window, 1.1) + border.color: Qt.darker(palette.window, 1.3) + Row { + spacing: 6 + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 12 + height: parent.height - 6 + width: parent.width + Button { + text: "Open" + anchors.verticalCenter: parent.verticalCenter + onClicked: fileDialog.open() + } + Button { + text: "Close" + anchors.verticalCenter: parent.verticalCenter + onClicked: fileDialog.close() + } + Button { + text: "go to /tmp" + anchors.verticalCenter: parent.verticalCenter + // TODO: QTBUG-29814 This isn't portable, but we don't expose QDir::tempPath to QML yet. + onClicked: fileDialog.folder = "/tmp" // file:///tmp would also be OK + } + } + } } diff --git a/examples/quick/dialogs/systemdialogs/doc/images/systemdialogs-example.jpg b/examples/quick/dialogs/systemdialogs/doc/images/systemdialogs-example.jpg Binary files differnew file mode 100644 index 0000000000..4517a39308 --- /dev/null +++ b/examples/quick/dialogs/systemdialogs/doc/images/systemdialogs-example.jpg diff --git a/examples/quick/dialogs/systemdialogs/doc/src/systemdialogs.qdoc b/examples/quick/dialogs/systemdialogs/doc/src/systemdialogs.qdoc new file mode 100644 index 0000000000..9788be7343 --- /dev/null +++ b/examples/quick/dialogs/systemdialogs/doc/src/systemdialogs.qdoc @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ +/*! + \title Qt Quick System Dialog Examples + \example systemdialogs + \brief This example demonstrates the system dialog types in QML + \image systemdialogs-example.jpg + \ingroup qtquickdialog_examples + + This example demonstrates the system dialogs in the \l{Qt Quick Dialogs} + module. The appearance and behavior is platform-dependent. + + A \l FileDialog is used to choose a single file, multiple files or a + single directory, depending on how it is configured. + \snippet systemdialogs/FileDialogs.qml filedialog + + A \l ColorDialog is used to choose a color, with or without alpha (transparency) + depending on how it is configured. + \snippet systemdialogs/ColorDialogs.qml colordialog + + The example can be built as a standalone executable, but each + type of dialog is demonstrated in a separate QML file which can + also be run separately with qmlscene. +*/ diff --git a/examples/quick/window/window/nogui.qml b/examples/quick/dialogs/systemdialogs/main.cpp index 2a5734c773..2119227c1f 100644 --- a/examples/quick/window/window/nogui.qml +++ b/examples/quick/dialogs/systemdialogs/main.cpp @@ -37,14 +37,5 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ - -import QtQml 2.0 - -/* - This object's only functionality is to exist as a root object and - display nothing, proving that qmlscene can run without windows. - (A QtObject can't even have Component.onCompleted) -*/ -QtObject { - property string philosophy: "hello bleak windowless world" -} +#include "../../shared/shared.h" +DECLARATIVE_EXAMPLE_MAIN(dialogs/systemdialogs) diff --git a/examples/quick/dialogs/systemdialogs/systemdialogs.pro b/examples/quick/dialogs/systemdialogs/systemdialogs.pro new file mode 100644 index 0000000000..e8c3e9857b --- /dev/null +++ b/examples/quick/dialogs/systemdialogs/systemdialogs.pro @@ -0,0 +1,17 @@ +TEMPLATE = app + +QT += quick qml +SOURCES += main.cpp +RESOURCES += systemdialogs.qrc ../../shared/shared.qrc + +OTHER_FILES += \ + systemdialogs.qml \ + FileDialogs.qml \ + ColorDialogs.qml + +EXAMPLE_FILES = \ + FileDialogs.qml \ + ColorDialogs.qml + +target.path = $$[QT_INSTALL_EXAMPLES]/quick/dialogs +INSTALLS += target diff --git a/examples/quick/window/window/Window.qml b/examples/quick/dialogs/systemdialogs/systemdialogs.qml index 07900930d3..b5f9841a3f 100644 --- a/examples/quick/window/window/Window.qml +++ b/examples/quick/dialogs/systemdialogs/systemdialogs.qml @@ -39,20 +39,21 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Window 2.0 +import "../shared" -Window { - width: 640 - height: 480 - visible: true //It's false by default - property Component self - Component.onCompleted: self = Qt.createComponent("Window.qml") - Text{ - text: "Hello World!" - anchors.centerIn: parent +TabSet { + width: 580 + height: 440 + + FileDialogs { + property string title: "File Dialog" + anchors.fill: parent + color: "#e3e3e3" // to match tab.png } - MouseArea{ + + ColorDialogs { + property string title: "Color Dialog" anchors.fill: parent - onClicked: self.createObject(); + color: "#e3e3e3" // to match tab.png } } diff --git a/examples/quick/dialogs/systemdialogs/systemdialogs.qrc b/examples/quick/dialogs/systemdialogs/systemdialogs.qrc new file mode 100644 index 0000000000..b90b99f7f5 --- /dev/null +++ b/examples/quick/dialogs/systemdialogs/systemdialogs.qrc @@ -0,0 +1,7 @@ +<RCC> + <qresource prefix="/dialogs"> + <file>systemdialogs.qml</file> + <file>FileDialogs.qml</file> + <file>ColorDialogs.qml</file> + </qresource> +</RCC> diff --git a/examples/quick/particles/imageparticle/doc/src/imageparticle.qdoc b/examples/quick/particles/imageparticle/doc/src/imageparticle.qdoc index 4fda13746a..ea94a4bc39 100644 --- a/examples/quick/particles/imageparticle/doc/src/imageparticle.qdoc +++ b/examples/quick/particles/imageparticle/doc/src/imageparticle.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \title Qt Quick Particles Examples - Affectors + \title Qt Quick Particles Examples - Image Particles \example particles/imageparticle \brief This is a collection of examples using Affectors in the QML particle system. \image qml-imageparticle-example.png diff --git a/examples/quick/particles/system/doc/src/system.qdoc b/examples/quick/particles/system/doc/src/system.qdoc index 99be23d9d1..385cd927da 100644 --- a/examples/quick/particles/system/doc/src/system.qdoc +++ b/examples/quick/particles/system/doc/src/system.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \title Qt Quick Particles Examples - Affectors + \title Qt Quick Particles Examples - System \example particles/system \brief This is a collection of examples using Affectors in the QML particle system. \image qml-system-example.png diff --git a/examples/quick/quick.pro b/examples/quick/quick.pro index 2d8acb3345..311e264af1 100644 --- a/examples/quick/quick.pro +++ b/examples/quick/quick.pro @@ -20,6 +20,7 @@ SUBDIRS = accessibility \ customitems \ imageprovider \ window \ + dialogs \ particles \ demos diff --git a/examples/quick/shared/Button.qml b/examples/quick/shared/Button.qml index 9942a17b5c..551f7d6e04 100644 --- a/examples/quick/shared/Button.qml +++ b/examples/quick/shared/Button.qml @@ -38,7 +38,7 @@ ** ****************************************************************************/ -import QtQuick 2.0 +import QtQuick 2.1 Item { id: container @@ -48,10 +48,10 @@ Item { signal clicked property alias containsMouse: mouseArea.containsMouse property alias pressed: mouseArea.pressed - implicitHeight: buttonLabel.implicitHeight - implicitWidth: buttonLabel.implicitWidth - height: buttonLabel.implicitHeight + 12 - width: Math.max(80, implicitWidth + 8) + implicitHeight: buttonLabel.implicitHeight * 1.2 + implicitWidth: buttonLabel.implicitWidth * 1.2 + height: implicitHeight + width: implicitWidth SystemPalette { id: palette } @@ -64,7 +64,7 @@ Item { GradientStop { position: 1.0; color: Qt.darker(palette.button, 1.3) } } antialiasing: true - radius: 5 + radius: height / 4 border.color: Qt.darker(palette.button, 1.5) border.width: 1 } @@ -78,10 +78,8 @@ Item { Text { id: buttonLabel - width: parent.width - horizontalAlignment: Text.Center text: container.text color: palette.buttonText - anchors.verticalCenter: parent.verticalCenter + anchors.centerIn: parent } } diff --git a/examples/quick/shared/TabSet.qml b/examples/quick/shared/TabSet.qml new file mode 100644 index 0000000000..10263a70ac --- /dev/null +++ b/examples/quick/shared/TabSet.qml @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: tabWidget + + // Setting the default property to stack.children means any child items + // of the TabWidget are actually added to the 'stack' item's children. + // See the "Property Binding" + // documentation for details on default properties. + default property alias content: stack.children + + property int current: 0 + + onCurrentChanged: setZOrders() + Component.onCompleted: setZOrders() + + function setZOrders() { + for (var i = 0; i < stack.children.length; ++i) + stack.children[i].z = (i == current ? 1 : 0) + } + + Row { + id: header + + Repeater { + model: stack.children.length + delegate: Rectangle { + width: tabWidget.width / stack.children.length; height: 36 + + Rectangle { + width: parent.width; height: 1 + anchors { bottom: parent.bottom; bottomMargin: 1 } + color: "#acb2c2" + } + BorderImage { + anchors { fill: parent; leftMargin: 2; topMargin: 5; rightMargin: 1 } + border { left: 7; right: 7 } + source: "images/tab.png" + visible: tabWidget.current == index + } + Text { + horizontalAlignment: Qt.AlignHCenter; verticalAlignment: Qt.AlignVCenter + anchors.fill: parent + text: stack.children[index].title + elide: Text.ElideRight + font.bold: tabWidget.current == index + } + MouseArea { + anchors.fill: parent + onClicked: tabWidget.current = index + } + } + } + } + + Item { + id: stack + width: tabWidget.width + anchors.top: header.bottom; anchors.bottom: tabWidget.bottom + } +} diff --git a/examples/quick/shared/images/qt-logo.png b/examples/quick/shared/images/qt-logo.png Binary files differnew file mode 100644 index 0000000000..7d3e97eb36 --- /dev/null +++ b/examples/quick/shared/images/qt-logo.png diff --git a/examples/quick/shared/images/tab.png b/examples/quick/shared/images/tab.png Binary files differnew file mode 100644 index 0000000000..ad8021605f --- /dev/null +++ b/examples/quick/shared/images/tab.png diff --git a/examples/quick/shared/qmldir b/examples/quick/shared/qmldir index cc4eb3c793..4f7c50540d 100644 --- a/examples/quick/shared/qmldir +++ b/examples/quick/shared/qmldir @@ -3,3 +3,4 @@ CheckBox 2.1 CheckBox.qml LauncherList 2.0 LauncherList.qml SimpleLauncherDelegate 2.0 SimpleLauncherDelegate.qml Slider 2.0 Slider.qml +TabSet 2.1 TabSet.qml diff --git a/examples/quick/shared/shared.h b/examples/quick/shared/shared.h index eab15f3e0a..c59e858d47 100644 --- a/examples/quick/shared/shared.h +++ b/examples/quick/shared/shared.h @@ -47,9 +47,9 @@ QQuickView view;\ view.connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit()));\ view.setSource(QUrl("qrc:///" #NAME ".qml")); \ + view.setResizeMode(QQuickView::SizeRootObjectToView);\ if (QGuiApplication::platformName() == QLatin1String("qnx") || \ QGuiApplication::platformName() == QLatin1String("eglfs")) {\ - view.setResizeMode(QQuickView::SizeRootObjectToView);\ view.showFullScreen();\ } else {\ view.show();\ diff --git a/examples/quick/shared/shared.qrc b/examples/quick/shared/shared.qrc index 0b574ac879..6aaeca5211 100644 --- a/examples/quick/shared/shared.qrc +++ b/examples/quick/shared/shared.qrc @@ -6,7 +6,11 @@ <file>Slider.qml</file> <file>images/slider_handle.png</file> <file>CheckBox.qml</file> + <file>TabSet.qml</file> <file>images/back.png</file> <file>images/next.png</file> + <file>images/qt-logo.png</file> + <file>images/checkmark.png</file> + <file>images/tab.png</file> </qresource> </RCC> diff --git a/examples/quick/window/screen/screenInfo.qml b/examples/quick/window/ScreenInfo.qml index 33fbc5d88e..e4abc8d69d 100644 --- a/examples/quick/window/screen/screenInfo.qml +++ b/examples/quick/window/ScreenInfo.qml @@ -44,7 +44,7 @@ import QtQuick.Window 2.1 Item { id: root width: 400 - height: 200 + height: propertyGrid.implicitHeight + 16 function orientationToString(o) { switch (o) { @@ -63,10 +63,13 @@ Item { } Grid { - anchors.centerIn: parent + id: propertyGrid columns: 2 spacing: 8 + x: spacing + y: spacing + //! [screen] Text { text: "Screen \"" + Screen.name + "\":" font.bold: true @@ -87,5 +90,6 @@ Item { Text { text: "primary orientation" } Text { text: orientationToString(Screen.primaryOrientation) + " (" + Screen.primaryOrientation + ")" } + //! [screen] } } diff --git a/examples/quick/window/window/twowindows.qml b/examples/quick/window/Splash.qml index 4a8d2f4f1b..c981bd2585 100644 --- a/examples/quick/window/window/twowindows.qml +++ b/examples/quick/window/Splash.qml @@ -39,51 +39,41 @@ ****************************************************************************/ import QtQuick 2.0 -import QtQuick.Window 2.0 +import QtQuick.Window 2.1 -QtObject { - property var win1: Window { - width: 320 - height: 240 - x: 0 - y: 0 - visible: true - color: "#ccffff" - title: "First Window" - Text { - anchors.centerIn: parent - text: "First Window" - Text { - id: statusText - anchors.top: parent.bottom - anchors.horizontalCenter: parent.horizontalCenter - } - } +//! [splash-properties] +Window { + id: splash + visible: true + width: splashImage.width + height: splashImage.height + color: "transparent" + title: "Splash Window" + modality: Qt.ApplicationModal + flags: Qt.SplashScreen + property int timeoutInterval: 2000 + signal timeout +//! [splash-properties] +//! [screen-properties] + x: (Screen.width - splashImage.width) / 2 + y: (Screen.height - splashImage.height) / 2 +//! [screen-properties] + + Image { + id: splashImage + source: "../../shared/images/qt-logo.png" MouseArea { anchors.fill: parent - onClicked: win2.visible = !win2.visible + onClicked: Qt.quit() } } - property var win2: Window { - width: 320 - height: 240 - x: 220 - y: 120 - visible: true - color: "green" - title: "Second Window: " + color - Rectangle { - anchors.fill: parent - anchors.margins: 10 - Text { - anchors.centerIn: parent - text: "Second Window" - } - MouseArea { - anchors.fill: parent - onClicked: win2.color = "#ffffcc" - } + //! [timer] + Timer { + interval: timeoutInterval; running: true; repeat: false + onTriggered: { + visible = false + splash.timeout() } - onVisibleChanged: statusText.text = "second window is " + (visible ? "visible" : "invisible") } + //! [timer] } diff --git a/examples/quick/window/doc/images/qml-window-example.png b/examples/quick/window/doc/images/qml-window-example.png Binary files differnew file mode 100644 index 0000000000..72487b4d93 --- /dev/null +++ b/examples/quick/window/doc/images/qml-window-example.png diff --git a/examples/quick/window/doc/src/window.qdoc b/examples/quick/window/doc/src/window.qdoc new file mode 100644 index 0000000000..07d2f115c1 --- /dev/null +++ b/examples/quick/window/doc/src/window.qdoc @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ +/*! + \title Qt Quick Examples - Window and Screen + \example window + \brief This example demonstrates the Window and Screen types in QML + \image qml-window-example.png + \ingroup qtquickexamples + + This example shows you how to create a Window in QML, how to control its + \l {QQuickWindow::visibility} {visibility}, how to present a splash screen + during application startup, and how to access the properties of the + \l Screen. It also demonstrates how to package QML into + \l {The Qt Resource System} {resources} and provide an + \l {Setting the Application Icon} {icon} to create a standalone QML desktop application. + + A splash screen can be created with the \l {Qt::SplashScreen} {Qt.SplashScreen} flag, + and should be \l {Qt::ApplicationModal} {ApplicationModal} to prevent interaction + with the main window. If the splash window is also transparent, and showing a + partially transparent image, then it will look like a shaped window. + \snippet window/Splash.qml splash-properties + + In this example a \l Timer will automatically dismiss the splash screen, + but in a real application you might want to connect to a signal from the + application logic to hide the splash when initialization is complete. + \snippet window/Splash.qml timer + + The main window in this example is the control window, with some buttons + and checkboxes to control and provide feedback on the state of a secondary + window. Each checkbox has a binding to the property whose state it is + displaying, and also an onClicked handler to change the state. This is the + typical pattern to create a two-way binding while avoiding binding loops. + \snippet window/window.qml windowedCheckbox + + The \l Screen has several properties which are generally useful to applications + which need to rotate some content when the screen orientation changes, to position + windows on the screen or to convert real units to logical pixel units. ScreenInfo.qml + (which is displayed inline in window.qml, or can be run by itself with qmlscene) + simply displays the property values, while the splash screen uses them to + center the window on the screen. + \snippet window/Splash.qml screen-properties + + If a Window is nested inside an \l Item or another Window, the inner window + becomes "transient for" the outer one (see \l Window for more explanation). + But if you want to create multiple top-level windows as unrelated peers, you + can create them inside a non-visual \l QtObject root item, as this example does. +*/ diff --git a/examples/quick/window/window/window.cpp b/examples/quick/window/main.cpp index 277effc20c..7872c7183c 100644 --- a/examples/quick/window/window/window.cpp +++ b/examples/quick/window/main.cpp @@ -41,6 +41,7 @@ #include <QtGui/QGuiApplication> #include <QtQml/QQmlEngine> #include <QtQml/QQmlComponent> +#include <QtQuick/QQuickWindow> #include <QtCore/QUrl> #include <QDebug> @@ -49,7 +50,8 @@ int main(int argc, char* argv[]) QGuiApplication app(argc, argv); QQmlEngine engine; QQmlComponent component(&engine); - component.loadUrl(QUrl("qrc:///window/window/Window.qml")); + QQuickWindow::setDefaultAlphaBuffer(true); + component.loadUrl(QUrl("qrc:///window/window.qml")); if ( component.isReady() ) component.create(); else diff --git a/examples/quick/window/resources/icon.icns b/examples/quick/window/resources/icon.icns Binary files differnew file mode 100644 index 0000000000..88b4b24449 --- /dev/null +++ b/examples/quick/window/resources/icon.icns diff --git a/examples/quick/window/resources/icon.ico b/examples/quick/window/resources/icon.ico Binary files differnew file mode 100644 index 0000000000..52af30a6ca --- /dev/null +++ b/examples/quick/window/resources/icon.ico diff --git a/examples/quick/window/resources/icon.svg b/examples/quick/window/resources/icon.svg new file mode 100644 index 0000000000..0b6153206d --- /dev/null +++ b/examples/quick/window/resources/icon.svg @@ -0,0 +1,208 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="128" + height="128" + id="svg2" + sodipodi:version="0.32" + inkscape:version="0.48.2 r9819" + version="1.0" + sodipodi:docname="icon.svg" + inkscape:export-filename="/Users/rutledge/dev/qt5-stable/qtdeclarative/examples/quick/window/window/icon80.png" + inkscape:export-xdpi="61.509998" + inkscape:export-ydpi="61.509998" + inkscape:output_extension="org.inkscape.output.svg.inkscape"> + <defs + id="defs4"> + <linearGradient + id="linearGradient4009"> + <stop + style="stop-color:#ffffff;stop-opacity:1;" + offset="0" + id="stop4011" /> + <stop + id="stop4019" + offset="0.875" + style="stop-color:#ffffff;stop-opacity:0.49803922;" /> + <stop + style="stop-color:#ffffff;stop-opacity:0;" + offset="1" + id="stop4013" /> + </linearGradient> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 186.64798 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="559.62469 : 186.64798 : 1" + inkscape:persp3d-origin="279.81235 : 124.43199 : 1" + id="perspective4876" /> + <inkscape:perspective + id="perspective2836" + inkscape:persp3d-origin="22 : 14.666667 : 1" + inkscape:vp_z="44 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_x="0 : 22 : 1" + sodipodi:type="inkscape:persp3d" /> + <filter + inkscape:collect="always" + id="filter4063" + x="-0.195491" + width="1.390982" + y="-0.16235915" + height="1.3247183"> + <feGaussianBlur + inkscape:collect="always" + stdDeviation="3.3077485" + id="feGaussianBlur4065" /> + </filter> + </defs> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + gridtolerance="10" + guidetolerance="10" + objecttolerance="10000" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="2.9775825" + inkscape:cx="62.656189" + inkscape:cy="42.423381" + inkscape:document-units="px" + inkscape:current-layer="layer1" + inkscape:window-width="1280" + inkscape:window-height="744" + inkscape:window-x="2003" + inkscape:window-y="156" + showgrid="true" + borderlayer="true" + showguides="true" + inkscape:guide-bbox="true" + inkscape:snap-global="false" + inkscape:window-maximized="0"> + <inkscape:grid + type="xygrid" + id="grid7194" + visible="true" + enabled="true" + spacingx="8px" + spacingy="8px" /> + </sodipodi:namedview> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(-66.38047,-391.3222)"> + <path + id="path7304" + d="M 95.556318,434.65407 L 165.25811,434.65407 L 165.25811,490.10429 L 95.556318,490.10429 L 95.556318,434.65407 z" + style="fill:#01afaf;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:5.24121141000000000;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" /> + <path + style="fill:#a7c706;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 96.869177,465.30846 c 27.677903,3.04574 41.155393,12.11589 48.000003,24 l -48.000003,0 0,-24 z" + id="path7300" + sodipodi:nodetypes="cccc" + inkscape:connector-curvature="0" /> + <path + sodipodi:nodetypes="cccc" + id="path7302" + d="M 165.46767,465.22201 C 137.78977,468.26775 124.31228,477.33791 117.46767,489.22201 L 165.46767,489.22201 L 165.46767,465.22201 z" + style="fill:#966406;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none;fill-opacity:1" /> + <path + style="fill:#80ffff;fill-rule:evenodd;stroke:#000000;stroke-width:5.24121141000000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;opacity:1;fill-opacity:1" + d="M 95.532809,434.35736 L 74.567964,420.38079 L 74.567964,497.25189 L 95.532809,490.26361 L 95.532809,434.35736 z" + id="path7270" + sodipodi:nodetypes="ccccc" /> + <path + style="fill:#00ffff;fill-rule:evenodd;stroke:#000000;stroke-width:5.24121141;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="M 74.567964,455.3222 L 95.532809,462.31048" + id="path7272" + sodipodi:nodetypes="cc" /> + <g + style="fill:#80ffff;fill-opacity:1" + id="g7278" + transform="matrix(-0.8735352,0,0,0.8735352,244.36615,64.570513)"> + <path + style="fill:#80ffff;fill-rule:evenodd;stroke:#000000;stroke-width:6;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:1" + d="M 24,32 L 0,16 L 0,104 L 24,96 L 24,32 z" + id="path7280" + transform="translate(66.38047,391.3222)" /> + <path + style="fill:#80ffff;fill-rule:evenodd;stroke:#000000;stroke-width:6;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:1" + d="M 0,56 L 24,64" + id="path7282" + transform="translate(66.38047,391.3222)" + sodipodi:nodetypes="cc" /> + </g> + <path + style="fill:#ffffff;fill-opacity:1;filter:url(#filter4063)" + d="m 119.74679,437.94232 c -0.0487,0.003 -0.0932,0.0315 -0.14149,0.0354 -0.1659,0.0132 -0.33372,0.008 -0.49523,0.0354 -0.96156,0.0643 -1.9037,0.14607 -2.86523,0.21224 -2.94807,0.23566 -5.19987,2.66253 -5.19987,6.01345 l 0,39.51194 3.32508,3.07747 0,-0.0354 33.2155,-5.58898 c 2.28673,-0.39587 4.06792,-3.06727 4.06792,-5.97808 l 0,-32.18967 -30.5625,-5.023 c -0.45263,-0.0748 -0.91269,-0.0942 -1.34418,-0.0708 z" + id="path3987" + inkscape:connector-curvature="0" /> + <g + id="g3" + transform="matrix(0.20572087,0,0,0.20572087,113.4162,440.80626)"> + <path + sodipodi:nodetypes="cccccccc" + id="path5" + style="fill:#006225" + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + inkscape:connector-curvature="0" /> + <path + id="path7" + style="fill:#80c342" + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + inkscape:connector-curvature="0" /> + <path + id="path11" + style="fill:#006225" + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + inkscape:connector-curvature="0" /> + <path + id="path13" + style="fill:#006225" + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + inkscape:connector-curvature="0" /> + <path + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" + style="fill:#ffffff" + id="path17" + inkscape:connector-curvature="0" /> + <path + id="path19" + style="fill:#006225" + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + inkscape:connector-curvature="0" /> + <path + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" + style="fill:#006225" + id="path21" + inkscape:connector-curvature="0" /> + </g> + <path + style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:5.24121141;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" + d="M 96.506224,434.65407 L 166.20801,434.65407 L 166.20801,490.10429 L 96.506224,490.10429 L 96.506224,434.65407 z" + id="rect7265" /> + </g> +</svg> diff --git a/examples/quick/window/resources/icon64.png b/examples/quick/window/resources/icon64.png Binary files differnew file mode 100644 index 0000000000..0fa324401f --- /dev/null +++ b/examples/quick/window/resources/icon64.png diff --git a/examples/quick/window/resources/window.rc b/examples/quick/window/resources/window.rc new file mode 100644 index 0000000000..4de84d297e --- /dev/null +++ b/examples/quick/window/resources/window.rc @@ -0,0 +1,32 @@ +#include "winver.h" + +IDI_ICON1 ICON DISCARDABLE "icon.ico" + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,0 + PRODUCTVERSION 1,0,0,0 + FILEFLAGS 0x0L + FILEFLAGSMASK 0x3fL + FILEOS 0x00040004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "000004b0" + BEGIN + VALUE "CompanyName", "Digia Plc and/or its subsidiary(-ies)" + VALUE "FileDescription", "QtQuick Window Example" + VALUE "FileVersion", "1.0.0.0" + VALUE "LegalCopyright", "Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies)." + VALUE "InternalName", "window" + VALUE "OriginalFilename", "window.exe" + VALUE "ProductName", "QtQuick Window Example" + VALUE "ProductVersion", "1.0.0.0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0, 1200 + END +END diff --git a/examples/quick/window/window.pro b/examples/quick/window/window.pro index 93e43fcd65..be35b24325 100644 --- a/examples/quick/window/window.pro +++ b/examples/quick/window/window.pro @@ -1,6 +1,16 @@ -TEMPLATE = subdirs -SUBDIRS += \ - window +TEMPLATE = app +QT += quick qml +SOURCES += main.cpp +RESOURCES += \ + window.qrc \ + ../shared/shared.qrc EXAMPLE_FILES = \ - screen + window.qml + +target.path = $$[QT_INSTALL_EXAMPLES]/quick/window +INSTALLS += target + +ICON = resources/icon64.png +macx: ICON = resources/icon.icns +win32: RC_FILE = resources/window.rc diff --git a/examples/quick/window/window.qml b/examples/quick/window/window.qml new file mode 100644 index 0000000000..67e2ba40ff --- /dev/null +++ b/examples/quick/window/window.qml @@ -0,0 +1,181 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Window 2.1 +import "../shared" as Shared + +QtObject { + property real defaultSpacing: 10 + property SystemPalette palette: SystemPalette { } + + property var controlWindow: Window { + width: 400 + height: col.implicitHeight + defaultSpacing * 2 + color: palette.window + title: "Control Window" + Column { + id: col + anchors.fill: parent + anchors.margins: defaultSpacing + spacing: defaultSpacing + property real cellWidth: col.width / 3 - spacing + Text { text: "Control the second window:" } + Grid { + id: grid + columns: 3 + spacing: defaultSpacing + width: parent.width + Shared.Button { + id: showButton + width: col.cellWidth + text: testWindow.visible ? "Hide" : "Show" + onClicked: testWindow.visible = !testWindow.visible + } + //! [windowedCheckbox] + Shared.CheckBox { + text: "Windowed" + height: showButton.height + width: col.cellWidth + Binding on checked { value: testWindow.visibility === Window.Windowed } + onClicked: testWindow.visibility = Window.Windowed + } + //! [windowedCheckbox] + Shared.CheckBox { + height: showButton.height + width: col.cellWidth + text: "Full Screen" + Binding on checked { value: testWindow.visibility === Window.FullScreen } + onClicked: testWindow.visibility = Window.FullScreen + } + Shared.Button { + id: autoButton + width: col.cellWidth + text: "Automatic" + onClicked: testWindow.visibility = Window.AutomaticVisibility + } + Shared.CheckBox { + height: autoButton.height + text: "Minimized" + Binding on checked { value: testWindow.visibility === Window.Minimized } + onClicked: testWindow.visibility = Window.Minimized + } + Shared.CheckBox { + height: autoButton.height + text: "Maximized" + Binding on checked { value: testWindow.visibility === Window.Maximized } + onClicked: testWindow.visibility = Window.Maximized + } + } + function visibilityToString(v) { + switch (v) { + case Window.Windowed: + return "windowed"; + case Window.Minimized: + return "minimized"; + case Window.Maximized: + return "maximized"; + case Window.FullScreen: + return "fullscreen"; + case Window.AutomaticVisibility: + return "automatic"; + case Window.Hidden: + return "hidden"; + } + return "unknown"; + } + Text { + text: "second window is " + (testWindow.visible ? "visible" : "invisible") + + " and has visibility " + parent.visibilityToString(testWindow.visibility) + } + Rectangle { + id: horizontalRule + color: "black" + width: parent.width + height: 1 + } + ScreenInfo { } + } + } + + property var testWindow: Window { + width: 320 + height: 240 + color: "#215400" + title: "Test Window with color " + color + Rectangle { + anchors.fill: parent + anchors.margins: defaultSpacing + Text { + anchors.centerIn: parent + text: "Second Window" + } + MouseArea { + anchors.fill: parent + onClicked: testWindow.color = "#e0c31e" + } + Shared.Button { + anchors.right: parent.right + anchors.top: parent.top + anchors.margins: defaultSpacing + text: testWindow.visibility === Window.FullScreen ? "exit fullscreen" : "go fullscreen" + width: 150 + onClicked: { + if (testWindow.visibility === Window.FullScreen) + testWindow.visibility = Window.AutomaticVisibility + else + testWindow.visibility = Window.FullScreen + } + } + Shared.Button { + anchors.left: parent.left + anchors.top: parent.top + anchors.margins: defaultSpacing + text: "X" + width: 30 + onClicked: testWindow.visible = false + } + } + } + + property var splashWindow: Splash { + onTimeout: controlWindow.visible = true + } +} diff --git a/examples/quick/window/window.qrc b/examples/quick/window/window.qrc new file mode 100644 index 0000000000..dc211bdaaf --- /dev/null +++ b/examples/quick/window/window.qrc @@ -0,0 +1,7 @@ +<RCC> + <qresource prefix="/window"> + <file>window.qml</file> + <file>Splash.qml</file> + <file>ScreenInfo.qml</file> + </qresource> +</RCC> diff --git a/examples/quick/window/window/standalone.qml b/examples/quick/window/window/standalone.qml deleted file mode 100644 index db73bf66eb..0000000000 --- a/examples/quick/window/window/standalone.qml +++ /dev/null @@ -1,128 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Window 2.0 - -Item { - width: 320 - height: 240 - // It's not possible to set an Item's windowTitle. If you want to modify - // window properties, you need to explicitly create a Window. - Text { - id: text1 - anchors.centerIn: parent - text: "First Window\n" + (Qt.application.supportsMultipleWindows ? - "click the button to open a second window" : "only one window is allowed") - } - Rectangle { - border.color: "black" - radius: 4 - anchors.top: text1.bottom - anchors.horizontalCenter: text1.horizontalCenter - width: 100 - height: 30 - TextInput { - id: ti1 - focus: true // but the modal popup will prevent input while it is open - anchors.centerIn: parent - } - } - Rectangle { - border.color: "black" - color: childWindow.visible ? "goldenrod" : "beige" - radius: height / 4 - anchors.bottom: parent.bottom - anchors.right: parent.right - anchors.margins: 10 - width: text.implicitWidth + 20 - height: text.implicitHeight + 20 - visible: Qt.application.supportsMultipleWindows - Text { - id: text - text: "Pop up window" - anchors.centerIn: parent - } - MouseArea { - anchors.fill: parent - onClicked: childWindow.visible = !childWindow.visible - } - } - - Window { - id: childWindow - width: 320 - height: 240 - x: 220 - y: 120 - color: "beige" - title: "Second Window" - modality: Qt.ApplicationModal - flags: Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint - Text { - id: text2 - anchors.centerIn: parent - text: "Modal Frameless Stay-on-Top Window" - } - Text { - anchors.top: parent.top - anchors.right: parent.right - anchors.margins: 10 - text: "X" - MouseArea{ - anchors.fill: parent - onClicked: childWindow.visible = false - } - } - Rectangle { - border.color: "black" - radius: 4 - anchors.top: text2.bottom - anchors.horizontalCenter: text2.horizontalCenter - width: 100 - height: 30 - TextInput { - id: ti2 - focus: true - anchors.centerIn: parent - } - } - } -} diff --git a/examples/quick/window/window/window.pro b/examples/quick/window/window/window.pro deleted file mode 100644 index 3525a893fa..0000000000 --- a/examples/quick/window/window/window.pro +++ /dev/null @@ -1,13 +0,0 @@ -TEMPLATE = app -QT += qml - -SOURCES += window.cpp -RESOURCES += window.qrc - -EXAMPLE_FILES = \ - nogui.qml \ - standalone.qml \ - twowindows.qml - -target.path = $$[QT_INSTALL_EXAMPLES]/quick/window/window -INSTALLS = target diff --git a/examples/quick/window/window/window.qrc b/examples/quick/window/window/window.qrc deleted file mode 100644 index c203c140fc..0000000000 --- a/examples/quick/window/window/window.qrc +++ /dev/null @@ -1,5 +0,0 @@ -<RCC> - <qresource prefix="/window/window"> - <file>Window.qml</file> - </qresource> -</RCC> diff --git a/src/imports/dialogs/DefaultColorDialog.qml b/src/imports/dialogs/DefaultColorDialog.qml index 7322aa18e7..8636259957 100644 --- a/src/imports/dialogs/DefaultColorDialog.qml +++ b/src/imports/dialogs/DefaultColorDialog.qml @@ -39,6 +39,7 @@ *****************************************************************************/ import QtQuick 2.1 +import QtQuick.Window 2.1 import QtQuick.Dialogs 1.0 import "qml" @@ -47,14 +48,17 @@ AbstractColorDialog { Rectangle { id: content - width: 320 - height: (usePaletteMap ? width : 0) + bottomMinHeight + property int maxSize: 0.9 * Math.min(Screen.desktopAvailableWidth, Screen.desktopAvailableHeight) + implicitHeight: Math.max(maxSize, Screen.logicalPixelDensity * (usePaletteMap ? 10 : 5)) + implicitWidth: usePaletteMap ? implicitHeight - bottomMinHeight : implicitHeight * 1.5 color: palette.window property real bottomMinHeight: sliders.height + buttonRow.height + outerSpacing * 3 property real spacing: 8 property real outerSpacing: 12 property bool usePaletteMap: true - property bool inited: false + + // set the preferred width based on height, to avoid "letterboxing" the paletteMap + onHeightChanged: implicitHeight = Math.max((usePaletteMap ? 480 : bottomMinHeight), height) SystemPalette { id: palette } diff --git a/src/imports/dialogs/DefaultFileDialog.qml b/src/imports/dialogs/DefaultFileDialog.qml index 5542e59cb5..2cdb34cc03 100644 --- a/src/imports/dialogs/DefaultFileDialog.qml +++ b/src/imports/dialogs/DefaultFileDialog.qml @@ -40,6 +40,7 @@ import QtQuick 2.1 import QtQuick.Dialogs 1.0 +import QtQuick.Window 2.1 import Qt.labs.folderlistmodel 2.0 import "qml" @@ -52,13 +53,13 @@ AbstractFileDialog { currentPathField.visible = false } } + onFolderChanged: view.model.folder = folder property bool showFocusHighlight: false - property real textX: 28 + property real textX: titleBar.height property SystemPalette palette property var selectedIndices: [] property int lastClickedIdx: -1 - folder: urlToPath(view.model.folder) function dirDown(path) { view.model.folder = path @@ -106,10 +107,11 @@ AbstractFileDialog { selectedIndices.map(function(idx) { if (view.model.isFolder(idx)) { if (selectFolder) - addSelection(view.model.get(idx, "filePath")) + // TODO after QTBUG-32039: should not need to convert pathToUrl here + addSelection(pathToUrl(view.model.get(idx, "filePath"))) } else { if (!selectFolder) - addSelection(view.model.get(idx, "filePath")) + addSelection(pathToUrl(view.model.get(idx, "filePath"))) } }) } @@ -117,11 +119,12 @@ AbstractFileDialog { } Rectangle { - width: 480 // TODO: QTBUG-29817 geometry from AbstractFileDialog - height: 320 + property int maxSize: Math.min(Screen.desktopAvailableWidth, Screen.desktopAvailableHeight) + // TODO: QTBUG-29817 geometry from AbstractFileDialog + implicitWidth: Math.min(maxSize, Screen.logicalPixelDensity * 100) + implicitHeight: Math.min(maxSize, Screen.logicalPixelDensity * 80) id: window color: palette.window - anchors.centerIn: Qt.application.supportsMultipleWindows ? null : parent SystemPalette { id: palette } @@ -209,7 +212,12 @@ AbstractFileDialog { clip: true x: 0 width: parent.width - model: FolderListModel { } + model: FolderListModel { + onFolderChanged: { + root.folder = folder + currentPathField.text = root.urlToPath(view.model.folder) + } + } delegate: folderDelegate highlight: Rectangle { color: "transparent" @@ -303,10 +311,9 @@ AbstractFileDialog { anchors.leftMargin: textX; anchors.rightMargin: 4 visible: false focus: visible - text: root.urlToPath(view.model.folder) onAccepted: { root.clearSelection() - if (root.addSelection(text)) + if (root.addSelection(root.pathToUrl(text))) root.accept() else view.model.folder = root.pathFolder(text) diff --git a/src/imports/dialogs/dialogs.pro b/src/imports/dialogs/dialogs.pro index b7704dadda..e745d52e2b 100644 --- a/src/imports/dialogs/dialogs.pro +++ b/src/imports/dialogs/dialogs.pro @@ -3,6 +3,8 @@ TARGET = dialogplugin TARGETPATH = QtQuick/Dialogs IMPORT_VERSION = 1.0 +QMAKE_DOCS = $$PWD/doc/qtquickdialogs.qdocconf + SOURCES += \ qquickabstractfiledialog.cpp \ qquickplatformfiledialog.cpp \ @@ -29,6 +31,7 @@ QML_FILES += \ WidgetColorDialog.qml \ qml/Button.qml \ qml/ColorSlider.qml \ + qml/DefaultWindowDecoration.qml \ qml/TextField.qml \ qml/qmldir \ images/checkers.png \ @@ -36,6 +39,7 @@ QML_FILES += \ images/crosshairs.png \ images/slider_handle.png \ images/sunken_frame.png \ + images/window_border.png \ images/folder.png \ images/up.png diff --git a/src/imports/dialogs/doc/qtquickdialogs.qdocconf b/src/imports/dialogs/doc/qtquickdialogs.qdocconf new file mode 100644 index 0000000000..34f19b5ff3 --- /dev/null +++ b/src/imports/dialogs/doc/qtquickdialogs.qdocconf @@ -0,0 +1,36 @@ +include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) + +project = QtQuickDialogs +description = Qt Quick Dialogs Reference Documentation +url = http://qt-project.org/doc/qt-$QT_VER/qtquickdialogs/ +version = $QT_VERSION + +qhp.projects = QtQuickDialogs + +qhp.QtQuickDialogs.file = qtquickdialogs.qhp +qhp.QtQuickDialogs.namespace = org.qt-project.qtquickdialogs.$QT_VERSION_TAG +qhp.QtQuickDialogs.virtualFolder = qtquickdialogs +qhp.QtQuickDialogs.indexTitle = Qt Quick Dialogs +qhp.QtQuickDialogs.indexRoot = + +qhp.QtQuickDialogs.filterAttributes = qtquickdialogs $QT_VERSION qtrefdoc +qhp.QtQuickDialogs.customFilters.Qt.name = QtQuickDialogs $QT_VERSION +qhp.QtQuickDialogs.customFilters.Qt.filterAttributes = qtquickdialogs $QT_VERSION + +qhp.QtQuickDialogs.subprojects = qtquickdialogsqmltypes +qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.title = QML Types +qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.indexTitle = Qt Quick Dialogs QML Types +qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.selectors = fake:qmlclass +qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.sortPages = true + +depends = qtqml qtquick qtgui qtwidgets qtdoc + +exampledirs += ../../../../examples/quick/dialogs + +examplesinstallpath = quick/dialogs + +headerdirs += .. + +sourcedirs += .. + +imagedirs += images diff --git a/src/imports/dialogs/doc/src/qtquickdialogs-examples.qdoc b/src/imports/dialogs/doc/src/qtquickdialogs-examples.qdoc new file mode 100644 index 0000000000..ee277f48dc --- /dev/null +++ b/src/imports/dialogs/doc/src/qtquickdialogs-examples.qdoc @@ -0,0 +1,36 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \group qtquickdialog_examples + \ingroup qtquickexamples + \title Qt Quick Examples - Dialogs + \brief A Collection of examples for \l{Qt Quick Dialogs}, written in QML. + + These examples show how to use the \l{Qt Quick Dialogs}. +*/ + diff --git a/src/imports/dialogs/doc/src/qtquickdialogs-index.qdoc b/src/imports/dialogs/doc/src/qtquickdialogs-index.qdoc new file mode 100644 index 0000000000..5a1223b04d --- /dev/null +++ b/src/imports/dialogs/doc/src/qtquickdialogs-index.qdoc @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \group dialogs + \title Dialogs +*/ + +/*! + \page qtquickdialogs-index.html + \title Qt Quick Dialogs + + \brief Qt Quick Dialogs submodule + + The module is new in Qt 5.1. + + \section1 Dialogs + + \annotatedlist dialogs + + \section1 Related information + + \section2 Examples + \list + \li \l{Qt Quick Examples - Dialogs}{Dialogs Examples} + \endlist + + \section2 Reference + \list + \li \l{Qt Quick Dialogs QML Types}{QML Types} + \endlist + +*/ + diff --git a/src/imports/dialogs/images/window_border.png b/src/imports/dialogs/images/window_border.png Binary files differnew file mode 100644 index 0000000000..431af8545d --- /dev/null +++ b/src/imports/dialogs/images/window_border.png diff --git a/src/imports/dialogs/plugin.cpp b/src/imports/dialogs/plugin.cpp index 67653e5965..8d1501cd03 100644 --- a/src/imports/dialogs/plugin.cpp +++ b/src/imports/dialogs/plugin.cpp @@ -48,6 +48,7 @@ #include "qquickabstractcolordialog_p.h" #include "qquickplatformcolordialog_p.h" #include <private/qguiapplication_p.h> +#include <qpa/qplatformintegration.h> //#define PURE_QML_ONLY @@ -57,7 +58,7 @@ QT_BEGIN_NAMESPACE /*! \qmlmodule QtQuick.Dialogs 1 - \title Qt Quick Dialog QML Types + \title Qt Quick Dialogs QML Types \ingroup qmlmodules \brief Provides QML types for standard file, color picker and message dialogs @@ -78,9 +79,18 @@ class QtQuick2DialogsPlugin : public QQmlExtensionPlugin public: QtQuick2DialogsPlugin() : QQmlExtensionPlugin() { } + virtual void initializeEngine(QQmlEngine *engine, const char *uri) { + //qDebug() << Q_FUNC_INFO << uri << m_decorationComponentUrl; + QQuickAbstractDialog::m_decorationComponent = + new QQmlComponent(engine, m_decorationComponentUrl, QQmlComponent::Asynchronous); + } + virtual void registerTypes(const char *uri) { Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQuick.Dialogs")); + bool hasTopLevelWindows = QGuiApplicationPrivate::platformIntegration()-> + hasCapability(QPlatformIntegration::MultipleWindows); QDir qmlDir(baseUrl().toLocalFile()); + m_decorationComponentUrl = QUrl::fromLocalFile(qmlDir.filePath(QString("qml/DefaultWindowDecoration.qml"))); QDir widgetsDir(baseUrl().toLocalFile()); // TODO: find the directory by searching rather than assuming a relative path widgetsDir.cd("../PrivateWidgets"); @@ -96,8 +106,7 @@ public: qmlRegisterType<QQuickPlatformFileDialog>(uri, DIALOGS_MAJOR_MINOR, "FileDialog"); else #endif - registerWidgetOrQmlImplementation<QQuickFileDialog>(widgetsDir, "WidgetFileDialog.qml", - qmlDir, "DefaultFileDialog.qml", "FileDialog", uri); + registerWidgetOrQmlImplementation<QQuickFileDialog>(widgetsDir, qmlDir, "FileDialog", uri, hasTopLevelWindows); // ColorDialog #ifndef PURE_QML_ONLY @@ -105,35 +114,37 @@ public: qmlRegisterType<QQuickPlatformColorDialog>(uri, DIALOGS_MAJOR_MINOR, "ColorDialog"); else #endif - registerWidgetOrQmlImplementation<QQuickColorDialog>(widgetsDir, "WidgetColorDialog.qml", - qmlDir, "DefaultColorDialog.qml", "ColorDialog", uri); + registerWidgetOrQmlImplementation<QQuickColorDialog>(widgetsDir, qmlDir, "ColorDialog", uri, hasTopLevelWindows); } protected: template <class WrapperType> - void registerWidgetOrQmlImplementation(QDir widgetsDir, QString widgetQmlFile, - QDir qmlDir, QString qmlFile, const char *qmlName, const char *uri) { + void registerWidgetOrQmlImplementation(QDir widgetsDir, QDir qmlDir, + const char *qmlName, const char *uri, bool hasTopLevelWindows) { + //qDebug() << Q_FUNC_INFO << qmlDir << qmlName << uri; bool needQml = true; + #ifndef PURE_QML_ONLY // If there is a qmldir and we have a QApplication instance (as opposed to a // widget-free QGuiApplication), assume that the widget-based dialog will work. - if (widgetsDir.exists("qmldir") && !widgetQmlFile.isEmpty() && + if (hasTopLevelWindows && widgetsDir.exists("qmldir") && !qstrcmp(QCoreApplication::instance()->metaObject()->className(), "QApplication")) { - QString dialogQmlPath = qmlDir.filePath(widgetQmlFile); + QString dialogQmlPath = qmlDir.filePath(QString("Widget%1.qml").arg(qmlName)); if (qmlRegisterType(QUrl::fromLocalFile(dialogQmlPath), uri, DIALOGS_MAJOR_MINOR, qmlName) >= 0) needQml = false; - // qDebug() << "registering" << qmlName << " as " << dialogQmlPath << "success?" << needQml; + // qDebug() << "registering" << qmlName << " as " << dialogQmlPath << "success?" << !needQml; } #endif if (needQml) { - QString dialogQmlPath = qmlDir.filePath(qmlFile); QByteArray abstractTypeName = QByteArray("Abstract") + qmlName; qmlRegisterType<WrapperType>(uri, DIALOGS_MAJOR_MINOR, abstractTypeName); // implementation wrapper + QString dialogQmlPath = qmlDir.filePath(QString("Default%1.qml").arg(qmlName)); // qDebug() << "registering" << qmlName << " as " << dialogQmlPath << "success?" << qmlRegisterType(QUrl::fromLocalFile(dialogQmlPath), uri, DIALOGS_MAJOR_MINOR, qmlName); } } + QUrl m_decorationComponentUrl; }; QT_END_NAMESPACE diff --git a/src/imports/dialogs/plugins.qmltypes b/src/imports/dialogs/plugins.qmltypes index 80eb8bd291..4e7090b960 100644 --- a/src/imports/dialogs/plugins.qmltypes +++ b/src/imports/dialogs/plugins.qmltypes @@ -39,6 +39,7 @@ Module { Property { name: "visible"; type: "bool" } Property { name: "modality"; type: "Qt::WindowModality" } Property { name: "title"; type: "string" } + Property { name: "isWindow"; type: "bool"; isReadonly: true } Property { name: "x"; type: "int" } Property { name: "y"; type: "int" } Property { name: "width"; type: "int" } @@ -56,7 +57,7 @@ Module { Property { name: "selectExisting"; type: "bool" } Property { name: "selectMultiple"; type: "bool" } Property { name: "selectFolder"; type: "bool" } - Property { name: "folder"; type: "string" } + Property { name: "folder"; type: "QUrl" } Property { name: "nameFilters"; type: "QStringList" } Property { name: "selectedNameFilter"; type: "string" } Property { name: "fileUrl"; type: "QUrl"; isReadonly: true } @@ -86,7 +87,7 @@ Module { } Method { name: "setFolder" - Parameter { name: "f"; type: "string" } + Parameter { name: "f"; type: "QUrl" } } Method { name: "setNameFilters" @@ -116,7 +117,7 @@ Module { Method { name: "addSelection" type: "bool" - Parameter { name: "path"; type: "string" } + Parameter { name: "path"; type: "QUrl" } } } } diff --git a/src/imports/dialogs/qml/Button.qml b/src/imports/dialogs/qml/Button.qml index 491dc2e251..4a0ec12cd3 100644 --- a/src/imports/dialogs/qml/Button.qml +++ b/src/imports/dialogs/qml/Button.qml @@ -39,6 +39,7 @@ *****************************************************************************/ import QtQuick 2.1 +import QtQuick.Window 2.1 Item { id: container @@ -48,10 +49,10 @@ Item { signal clicked property alias containsMouse: mouseArea.containsMouse property alias pressed: mouseArea.pressed - implicitHeight: buttonLabel.implicitHeight - implicitWidth: buttonLabel.implicitWidth - height: buttonLabel.implicitHeight + 12 - width: Math.max(80, implicitWidth + 8) + implicitHeight: buttonLabel.implicitHeight * 1.2 + implicitWidth: Math.max(Screen.logicalPixelDensity * 10, buttonLabel.implicitWidth * 1.2) + height: implicitHeight + width: implicitWidth SystemPalette { id: palette } @@ -64,7 +65,7 @@ Item { GradientStop { position: 1.0; color: Qt.darker(palette.button, 1.3) } } antialiasing: true - radius: 5 + radius: height / 4 border.color: Qt.darker(palette.button, 1.5) border.width: 1 } @@ -78,10 +79,8 @@ Item { Text { id: buttonLabel - width: parent.width - horizontalAlignment: Text.Center text: container.text color: palette.buttonText - anchors.verticalCenter: parent.verticalCenter + anchors.centerIn: parent } } diff --git a/src/imports/dialogs/qml/DefaultWindowDecoration.qml b/src/imports/dialogs/qml/DefaultWindowDecoration.qml new file mode 100644 index 0000000000..69a8658aba --- /dev/null +++ b/src/imports/dialogs/qml/DefaultWindowDecoration.qml @@ -0,0 +1,68 @@ +/***************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtQuick.Dialogs module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +*****************************************************************************/ + +import QtQuick 2.1 + +Rectangle { + color: "#80000000" + anchors.fill: parent + z: 1000000 + property alias content: borderImage.content + property bool dismissOnOuterClick: true + signal dismissed + MouseArea { + anchors.fill: parent + enabled: dismissOnOuterClick + onClicked: dismissed() + BorderImage { + id: borderImage + property Item content + + width: content ? content.width + 15 : 0 + height: content ? content.height + 15 : 0 + onWidthChanged: content.x = 5 + onHeightChanged: content.y = 5 + border { left: 10; top: 10; right: 10; bottom: 10 } + source: "../images/window_border.png" + anchors.centerIn: parent + onContentChanged: if (content) content.parent = borderImage + } + } +} diff --git a/src/imports/dialogs/qml/TextField.qml b/src/imports/dialogs/qml/TextField.qml index baa469caa9..9a6427a105 100644 --- a/src/imports/dialogs/qml/TextField.qml +++ b/src/imports/dialogs/qml/TextField.qml @@ -45,10 +45,10 @@ Item { property alias textInput: textInput property alias text: textInput.text - property real implicitWidth: textInput.implicitWidth + rect.radius * 2 - property real implicitHeight: textInput.implicitHeight + rect.radius * 2 signal accepted signal downPressed + implicitWidth: textInput.implicitWidth + rect.radius * 2 + implicitHeight: textInput.implicitHeight function copyAll() { textInput.selectAll() diff --git a/src/imports/dialogs/qquickabstractcolordialog.cpp b/src/imports/dialogs/qquickabstractcolordialog.cpp index 9a9f3bc11b..7cfd7ea692 100644 --- a/src/imports/dialogs/qquickabstractcolordialog.cpp +++ b/src/imports/dialogs/qquickabstractcolordialog.cpp @@ -91,7 +91,7 @@ bool QQuickAbstractColorDialog::showAlphaChannel() const return m_options->testOption(QColorDialogOptions::ShowAlphaChannel); } -void QQuickAbstractColorDialog::setTitle(QString t) +void QQuickAbstractColorDialog::setTitle(const QString &t) { if (m_options->windowTitle() == t) return; m_options->setWindowTitle(t); diff --git a/src/imports/dialogs/qquickabstractcolordialog_p.h b/src/imports/dialogs/qquickabstractcolordialog_p.h index 3301605c86..46f0f84acb 100644 --- a/src/imports/dialogs/qquickabstractcolordialog_p.h +++ b/src/imports/dialogs/qquickabstractcolordialog_p.h @@ -78,7 +78,7 @@ public: public Q_SLOTS: void setVisible(bool v); void setModality(Qt::WindowModality m); - void setTitle(QString t); + void setTitle(const QString &t); void setColor(QColor arg); void setShowAlphaChannel(bool arg); diff --git a/src/imports/dialogs/qquickabstractdialog.cpp b/src/imports/dialogs/qquickabstractdialog.cpp index abdc9e067c..560cbaf3e0 100644 --- a/src/imports/dialogs/qquickabstractdialog.cpp +++ b/src/imports/dialogs/qquickabstractdialog.cpp @@ -44,11 +44,14 @@ #include <private/qguiapplication_p.h> #include <QWindow> +#include <QQmlComponent> #include <QQuickWindow> #include <qpa/qplatformintegration.h> QT_BEGIN_NAMESPACE +QQmlComponent *QQuickAbstractDialog::m_decorationComponent(0); + QQuickAbstractDialog::QQuickAbstractDialog(QObject *parent) : QObject(parent) , m_parentWindow(0) @@ -56,6 +59,10 @@ QQuickAbstractDialog::QQuickAbstractDialog(QObject *parent) , m_modality(Qt::WindowModal) , m_qmlImplementation(0) , m_dialogWindow(0) + , m_contentItem(0) + , m_windowDecoration(0) + , m_hasNativeWindows(QGuiApplicationPrivate::platformIntegration()-> + hasCapability(QPlatformIntegration::MultipleWindows)) { } @@ -82,36 +89,47 @@ void QQuickAbstractDialog::setVisible(bool v) if (!m_dialogWindow) { m_dialogWindow = qobject_cast<QWindow *>(m_qmlImplementation); if (!m_dialogWindow) { - QQuickItem *dlgItem = qobject_cast<QQuickItem *>(m_qmlImplementation); - if (dlgItem) { - m_dialogWindow = dlgItem->window(); + m_contentItem = qobject_cast<QQuickItem *>(m_qmlImplementation); + if (m_contentItem) { + m_dialogWindow = m_contentItem->window(); // An Item-based dialog implementation doesn't come with a window, so // we have to instantiate one iff the platform allows it. - if (!m_dialogWindow && QGuiApplicationPrivate::platformIntegration()-> - hasCapability(QPlatformIntegration::MultipleWindows)) { + if (!m_dialogWindow && m_hasNativeWindows) { QQuickWindow *win = new QQuickWindow; ((QObject *)win)->setParent(this); // memory management only m_dialogWindow = win; - dlgItem->setParentItem(win->contentItem()); - m_dialogWindow->setMinimumSize(QSize(dlgItem->width(), dlgItem->height())); + m_contentItem->setParentItem(win->contentItem()); + m_dialogWindow->setMinimumSize(QSize(m_contentItem->implicitWidth(), m_contentItem->implicitHeight())); connect(win, SIGNAL(widthChanged(int)), this, SLOT(windowGeometryChanged())); connect(win, SIGNAL(heightChanged(int)), this, SLOT(windowGeometryChanged())); } QQuickItem *parentItem = qobject_cast<QQuickItem *>(parent()); - // qDebug() << "item implementation" << dlgItem << "has window" << m_dialogWindow << "and parent" << parentItem; // If the platform does not support multiple windows, but the dialog is - // implemented as an Item, then just reparent it and make it visible. - // TODO QTBUG-29818: put it into a fake Item-based window, when we have a reusable self-decorated one. - if (parentItem && !m_dialogWindow) - dlgItem->setParentItem(parentItem); + // implemented as an Item, then try to decorate it as a fake window and make it visible. + if (parentItem && !m_dialogWindow && !m_windowDecoration) { + if (m_decorationComponent) { + if (m_decorationComponent->isLoading()) + connect(m_decorationComponent, SIGNAL(statusChanged(QQmlComponent::Status)), + this, SLOT(decorationLoaded())); + else + decorationLoaded(); + } + // Window decoration wasn't possible, so just reparent it into the scene + else { + m_contentItem->setParentItem(parentItem); + m_contentItem->setZ(10000); + } + } } } if (m_dialogWindow) connect(m_dialogWindow, SIGNAL(visibleChanged(bool)), this, SLOT(visibleChanged(bool))); } - if (m_dialogWindow) { + if (m_windowDecoration) { + m_windowDecoration->setVisible(v); + } else if (m_dialogWindow) { if (v) { m_dialogWindow->setTransientParent(parentWindow()); m_dialogWindow->setTitle(title()); @@ -124,6 +142,38 @@ void QQuickAbstractDialog::setVisible(bool v) emit visibilityChanged(); } +void QQuickAbstractDialog::decorationLoaded() +{ + bool ok = false; + QQuickItem *parentItem = qobject_cast<QQuickItem *>(parent()); + if (m_decorationComponent->isError()) { + qWarning() << m_decorationComponent->errors(); + } else { + QObject *decoration = m_decorationComponent->create(); + m_windowDecoration = qobject_cast<QQuickItem *>(decoration); + if (m_windowDecoration) { + m_windowDecoration->setParentItem(parentItem); + // Give the window decoration its content to manage + QVariant contentVariant; + contentVariant.setValue<QQuickItem*>(m_contentItem); + m_windowDecoration->setProperty("content", contentVariant); + connect(m_windowDecoration, SIGNAL(dismissed()), this, SLOT(reject())); + ok = true; + } else { + qWarning() << m_decorationComponent->url() << + "cannot be used as a window decoration because it's not an Item"; + delete m_windowDecoration; + delete m_decorationComponent; + m_decorationComponent = 0; + } + } + // Window decoration wasn't possible, so just reparent it into the scene + if (!ok) { + m_contentItem->setParentItem(parentItem); + m_contentItem->setZ(10000); + } +} + void QQuickAbstractDialog::setModality(Qt::WindowModality m) { if (m_modality == m) return; @@ -152,7 +202,6 @@ void QQuickAbstractDialog::visibleChanged(bool v) void QQuickAbstractDialog::windowGeometryChanged() { QQuickItem *content = qobject_cast<QQuickItem*>(m_qmlImplementation); -qDebug() << Q_FUNC_INFO << m_dialogWindow << content; if (m_dialogWindow && content) { content->setWidth(m_dialogWindow->width()); content->setHeight(m_dialogWindow->height()); diff --git a/src/imports/dialogs/qquickabstractdialog_p.h b/src/imports/dialogs/qquickabstractdialog_p.h index 2ad24f98e0..5e3d9b43f7 100644 --- a/src/imports/dialogs/qquickabstractdialog_p.h +++ b/src/imports/dialogs/qquickabstractdialog_p.h @@ -66,6 +66,7 @@ class QQuickAbstractDialog : public QObject Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibilityChanged) Q_PROPERTY(Qt::WindowModality modality READ modality WRITE setModality NOTIFY modalityChanged) Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged) + Q_PROPERTY(bool isWindow READ isWindow CONSTANT) Q_PROPERTY(int x READ x WRITE setX NOTIFY geometryChanged) Q_PROPERTY(int y READ y WRITE setY NOTIFY geometryChanged) Q_PROPERTY(int width READ width WRITE setWidth NOTIFY geometryChanged) @@ -87,8 +88,9 @@ public: virtual void setVisible(bool v); virtual void setModality(Qt::WindowModality m); - virtual void setTitle(QString t) = 0; + virtual void setTitle(const QString &t) = 0; void setQmlImplementation(QObject* obj); + bool isWindow() const { return m_hasNativeWindows; } void setX(int arg); void setY(int arg); void setWidth(int arg); @@ -107,6 +109,7 @@ Q_SIGNALS: void rejected(); protected Q_SLOTS: + void decorationLoaded(); void accept(); void reject(); void visibleChanged(bool v); @@ -124,6 +127,13 @@ protected: protected: // variables for pure-QML implementations only QObject *m_qmlImplementation; QWindow *m_dialogWindow; + QQuickItem *m_contentItem; + QQuickItem *m_windowDecoration; + bool m_hasNativeWindows; + + static QQmlComponent *m_decorationComponent; + + friend class QtQuick2DialogsPlugin; Q_DISABLE_COPY(QQuickAbstractDialog) }; diff --git a/src/imports/dialogs/qquickabstractfiledialog.cpp b/src/imports/dialogs/qquickabstractfiledialog.cpp index 32442de41f..d8a75feb53 100644 --- a/src/imports/dialogs/qquickabstractfiledialog.cpp +++ b/src/imports/dialogs/qquickabstractfiledialog.cpp @@ -78,7 +78,7 @@ QString QQuickAbstractFileDialog::title() const return m_options->windowTitle(); } -void QQuickAbstractFileDialog::setTitle(QString t) +void QQuickAbstractFileDialog::setTitle(const QString &t) { if (m_options->windowTitle() == t) return; m_options->setWindowTitle(t); @@ -106,18 +106,19 @@ void QQuickAbstractFileDialog::setSelectFolder(bool selectFolder) updateModes(); } -QString QQuickAbstractFileDialog::folder() +QUrl QQuickAbstractFileDialog::folder() { if (m_dlgHelper && !m_dlgHelper->directory().isEmpty()) - return m_dlgHelper->directory(); - return m_options->initialDirectory(); + return QUrl::fromLocalFile(m_dlgHelper->directory()); + return QUrl::fromLocalFile(m_options->initialDirectory()); } -void QQuickAbstractFileDialog::setFolder(QString f) +void QQuickAbstractFileDialog::setFolder(const QUrl &f) { + QString dir = f.path(); if (m_dlgHelper) - m_dlgHelper->setDirectory(f); - m_options->setInitialDirectory(f); + m_dlgHelper->setDirectory(dir); + m_options->setInitialDirectory(dir); emit folderChanged(); } @@ -141,7 +142,7 @@ QString QQuickAbstractFileDialog::selectedNameFilter() return ret; } -void QQuickAbstractFileDialog::selectNameFilter(QString f) +void QQuickAbstractFileDialog::selectNameFilter(const QString &f) { // This should work whether the dialog is currently being shown already, or ahead of time. m_options->setInitiallySelectedNameFilter(f); diff --git a/src/imports/dialogs/qquickabstractfiledialog_p.h b/src/imports/dialogs/qquickabstractfiledialog_p.h index 965f1a7029..5ce48e8055 100644 --- a/src/imports/dialogs/qquickabstractfiledialog_p.h +++ b/src/imports/dialogs/qquickabstractfiledialog_p.h @@ -67,7 +67,7 @@ class QQuickAbstractFileDialog : public QQuickAbstractDialog Q_PROPERTY(bool selectExisting READ selectExisting WRITE setSelectExisting NOTIFY fileModeChanged) Q_PROPERTY(bool selectMultiple READ selectMultiple WRITE setSelectMultiple NOTIFY fileModeChanged) Q_PROPERTY(bool selectFolder READ selectFolder WRITE setSelectFolder NOTIFY fileModeChanged) - Q_PROPERTY(QString folder READ folder WRITE setFolder NOTIFY folderChanged) + Q_PROPERTY(QUrl folder READ folder WRITE setFolder NOTIFY folderChanged) Q_PROPERTY(QStringList nameFilters READ nameFilters WRITE setNameFilters NOTIFY nameFiltersChanged) Q_PROPERTY(QString selectedNameFilter READ selectedNameFilter WRITE selectNameFilter NOTIFY filterSelected) Q_PROPERTY(QUrl fileUrl READ fileUrl NOTIFY selectionAccepted) @@ -81,7 +81,7 @@ public: bool selectExisting() const { return m_selectExisting; } bool selectMultiple() const { return m_selectMultiple; } bool selectFolder() const { return m_selectFolder; } - QString folder(); + QUrl folder(); QStringList nameFilters() const { return m_options->nameFilters(); } QString selectedNameFilter(); QUrl fileUrl(); @@ -89,13 +89,13 @@ public: public Q_SLOTS: void setVisible(bool v); - void setTitle(QString t); + void setTitle(const QString &t); void setSelectExisting(bool s); void setSelectMultiple(bool s); void setSelectFolder(bool s); - void setFolder(QString f); + void setFolder(const QUrl &f); void setNameFilters(const QStringList &f); - void selectNameFilter(QString f); + void selectNameFilter(const QString &f); Q_SIGNALS: void folderChanged(); diff --git a/src/imports/dialogs/qquickcolordialog.cpp b/src/imports/dialogs/qquickcolordialog.cpp index 39af99770e..d0e0e11b07 100644 --- a/src/imports/dialogs/qquickcolordialog.cpp +++ b/src/imports/dialogs/qquickcolordialog.cpp @@ -64,13 +64,13 @@ QT_BEGIN_NAMESPACE /*! \qmlsignal QtQuick::Dialogs::AbstractColorDialog::accepted - The \a accepted signal is emitted by \l accept(). + This signal is emitted by \l accept(). */ /*! \qmlsignal QtQuick::Dialogs::AbstractColorDialog::rejected - The \a accepted signal is emitted by \l reject(). + This signal is emitted by \l reject(). */ /*! @@ -110,12 +110,6 @@ QQuickColorDialog::~QQuickColorDialog() */ /*! - \qmlproperty bool AbstractColorDialog::filePaths - - A list of files to be populated as the user chooses. -*/ - -/*! \qmlproperty QObject AbstractColorDialog::implementation The QML object which implements the actual file dialog. Should be either a diff --git a/src/imports/dialogs/qquickfiledialog.cpp b/src/imports/dialogs/qquickfiledialog.cpp index f78e8a6f8d..2ee4afc5d2 100644 --- a/src/imports/dialogs/qquickfiledialog.cpp +++ b/src/imports/dialogs/qquickfiledialog.cpp @@ -64,13 +64,13 @@ QT_BEGIN_NAMESPACE /*! \qmlsignal QtQuick::Dialogs::AbstractFileDialog::accepted - The \a accepted signal is emitted by \l accept(). + This signal is emitted by \l accept(). */ /*! \qmlsignal QtQuick::Dialogs::AbstractFileDialog::rejected - The \a accepted signal is emitted by \l reject(). + This signal is emitted by \l reject(). */ /*! @@ -105,10 +105,7 @@ QQuickFileDialog::~QQuickFileDialog() QList<QUrl> QQuickFileDialog::fileUrls() { - QList<QUrl> ret; - foreach (QString path, m_selections) - ret << QUrl::fromLocalFile(path); - return ret; + return m_selections; } /*! @@ -118,13 +115,13 @@ QList<QUrl> QQuickFileDialog::fileUrls() */ /*! - \qmlproperty bool AbstractFileDialog::filePaths + \qmlproperty bool AbstractFileDialog::fileUrls A list of files to be populated as the user chooses. */ /*! - \brief Clears \l filePaths + \brief Clears \l fileUrls */ void QQuickFileDialog::clearSelection() { @@ -132,20 +129,18 @@ void QQuickFileDialog::clearSelection() } /*! - \brief Adds one file to \l filePaths + \brief Adds one file to \l fileUrls - \l path should be given as an absolute file system path. If it is given as a - file:// URL, it will be converted to a path. Returns true on success, - false if the given path is not valid given the current setting properties. + \l path should be given as an absolute file:// path URL. + Returns true on success, false if the given path is + not valid given the current property settings. */ -bool QQuickFileDialog::addSelection(QString path) +bool QQuickFileDialog::addSelection(const QUrl &path) { - if (path.startsWith("file:")) - path = QUrl(path).toLocalFile(); - QFileInfo info(path); + QFileInfo info(path.toLocalFile()); if (info.exists() && ((info.isDir() && m_selectFolder) || !info.isDir())) { if (m_selectFolder) - m_selections.append(pathFolder(path).toLocalFile()); + m_selections.append(pathFolder(path.toLocalFile())); else m_selections.append(path); return true; diff --git a/src/imports/dialogs/qquickfiledialog_p.h b/src/imports/dialogs/qquickfiledialog_p.h index 93e11f9e3e..0176bc3fe4 100644 --- a/src/imports/dialogs/qquickfiledialog_p.h +++ b/src/imports/dialogs/qquickfiledialog_p.h @@ -72,7 +72,7 @@ signals: public Q_SLOTS: void clearSelection(); - bool addSelection(QString path); + bool addSelection(const QUrl &path); protected: virtual QPlatformFileDialogHelper *helper() { return 0; } @@ -81,7 +81,7 @@ protected: Q_INVOKABLE QUrl pathFolder(const QString &path); private: - QStringList m_selections; + QList<QUrl> m_selections; Q_DISABLE_COPY(QQuickFileDialog) }; diff --git a/src/imports/dialogs/qquickplatformcolordialog.cpp b/src/imports/dialogs/qquickplatformcolordialog.cpp index 491a2e687c..8dc6d09f2c 100644 --- a/src/imports/dialogs/qquickplatformcolordialog.cpp +++ b/src/imports/dialogs/qquickplatformcolordialog.cpp @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE \qmltype ColorDialog \instantiates QQuickPlatformColorDialog \inqmlmodule QtQuick.Dialogs 1 - \ingroup qtquick-visual + \ingroup dialogs \brief Dialog component for choosing a color. \since Qt 5.1 @@ -102,8 +102,8 @@ QT_BEGIN_NAMESPACE /*! \qmlsignal QtQuick::Dialogs::ColorDialog::accepted - The \a accepted signal is emitted when the user has finished using the - dialog. You can then inspect the \a color property to get the selection. + This handler is called when the user has finished using the + dialog. You can then inspect the \l color property to get the selection. Example: @@ -117,7 +117,7 @@ QT_BEGIN_NAMESPACE /*! \qmlsignal QtQuick::Dialogs::ColorDialog::rejected - The \a rejected signal is emitted when the user has dismissed the dialog, + This handler is called when the user has dismissed the dialog, either by closing the dialog window or by pressing the Cancel button. */ diff --git a/src/imports/dialogs/qquickplatformfiledialog.cpp b/src/imports/dialogs/qquickplatformfiledialog.cpp index d767f65499..3da9f6c3b2 100644 --- a/src/imports/dialogs/qquickplatformfiledialog.cpp +++ b/src/imports/dialogs/qquickplatformfiledialog.cpp @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE \qmltype FileDialog \instantiates QQuickPlatformFileDialog \inqmlmodule QtQuick.Dialogs 1 - \ingroup qtquick-visual + \ingroup dialogs \brief Dialog component for choosing files from a local filesystem. \since Qt 5.1 @@ -73,7 +73,7 @@ QT_BEGIN_NAMESPACE id: fileDialog title: "Please choose a file" onAccepted: { - console.log("You chose: " + fileDialog.filePaths) + console.log("You chose: " + fileDialog.fileUrls) Qt.quit() } onRejected: { @@ -103,15 +103,15 @@ QT_BEGIN_NAMESPACE /*! \qmlsignal QtQuick::Dialogs::FileDialog::accepted - The \a accepted signal is emitted when the user has finished using the - dialog. You can then inspect the \a filePath or \a filePaths properties to + This handler is called when the user has finished using the + dialog. You can then inspect the \l fileUrl or \l fileUrls properties to get the selection. Example: \qml FileDialog { - onAccepted: { console.log("Selected file: " + filePath) } + onAccepted: { console.log("Selected file: " + fileUrl) } } \endqml */ @@ -119,7 +119,7 @@ QT_BEGIN_NAMESPACE /*! \qmlsignal QtQuick::Dialogs::FileDialog::rejected - The \a rejected signal is emitted when the user has dismissed the dialog, + This handler is called when the user has dismissed the dialog, either by closing the dialog window or by pressing the Cancel button. */ @@ -191,7 +191,7 @@ QPlatformFileDialogHelper *QQuickPlatformFileDialog::helper() containing the dialog's parent Item, modal with respect to the whole application, or non-modal. - By default it is \l WindowModal. + By default it is \c Qt.WindowModal. Modality does not mean that there are any blocking calls to wait for the dialog to be accepted or rejected; it's only that the user will be @@ -252,7 +252,7 @@ QPlatformFileDialogHelper *QQuickPlatformFileDialog::helper() */ /*! - \qmlproperty string FileDialog::folder + \qmlproperty url FileDialog::folder The path to the currently selected folder. Setting this property before invoking open() will cause the file browser to be initially positioned on @@ -295,18 +295,18 @@ QPlatformFileDialogHelper *QQuickPlatformFileDialog::helper() */ /*! - \qmlproperty string FileDialog::filePath + \qmlproperty url FileDialog::fileUrl The path of the file which was selected by the user. \note This property is set only if exactly one file was selected. In all - other cases, it will return an empty string. + other cases, it will be empty. - \sa filePaths + \sa fileUrls */ /*! - \qmlproperty list<string> FileDialog::filePaths + \qmlproperty list<url> FileDialog::fileUrls The list of file paths which were selected by the user. */ diff --git a/src/imports/models/plugin.cpp b/src/imports/models/plugin.cpp index 2181562098..90e8a56399 100644 --- a/src/imports/models/plugin.cpp +++ b/src/imports/models/plugin.cpp @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE /*! \qmlmodule QtQml.Models 2 - \title Qt QML Model QML Types + \title Qt QML Models QML Types \ingroup qmlmodules \brief Provides QML types for data models \since 5.1 @@ -60,7 +60,8 @@ QT_BEGIN_NAMESPACE import QtQml.Models 2.1 \endcode - Note that QtQml.Models module started at version 2.1 to match the version of the parent module. + Note that QtQml.Models module started at version 2.1 to match the version + of the parent module, \l{Qt QML}. */ diff --git a/src/imports/qtquick2/plugins.qmltypes b/src/imports/qtquick2/plugins.qmltypes index e5381629cc..cc619dc4ff 100644 --- a/src/imports/qtquick2/plugins.qmltypes +++ b/src/imports/qtquick2/plugins.qmltypes @@ -3,12 +3,20 @@ import QtQuick.tooling 1.1 // This file describes the plugin-supplied types contained in the library. // It is used for QML tooling purposes only. // -// This file was auto-generated with the command 'qmlplugindump -builtins'. +// This file was auto-generated with the command 'qmlplugindump -notrelocatable -builtins'. Module { Component { name: "QAbstractItemModel" prototype: "QObject" + Enum { + name: "LayoutChangeHint" + values: { + "NoLayoutChangeHint": 0, + "VerticalSortHint": 1, + "HorizontalSortHint": 2 + } + } Signal { name: "dataChanged" Parameter { name: "topLeft"; type: "QModelIndex" } @@ -167,6 +175,7 @@ Module { name: "QInputMethod" prototype: "QObject" exports: ["QtQuick/InputMethod 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "Action" values: { @@ -215,6 +224,7 @@ Module { Component { name: "QObject" exports: ["QtQml/QtObject 2.0", "QtQuick/QtObject 2.0"] + exportMetaObjectRevisions: [0, 0] Property { name: "objectName"; type: "string" } Signal { name: "objectNameChanged" @@ -228,9 +238,26 @@ Module { } } Component { + name: "QQmlApplication" + prototype: "QObject" + Property { name: "arguments"; type: "QStringList"; isReadonly: true } + Property { name: "name"; type: "string" } + Property { name: "version"; type: "string" } + Signal { name: "aboutToQuit" } + Method { + name: "setName" + Parameter { name: "arg"; type: "string" } + } + Method { + name: "setVersion" + Parameter { name: "arg"; type: "string" } + } + } + Component { name: "QQmlBind" prototype: "QObject" exports: ["QtQml/Binding 2.0", "QtQuick/Binding 2.0"] + exportMetaObjectRevisions: [0, 0] Property { name: "target"; type: "QObject"; isPointer: true } Property { name: "property"; type: "string" } Property { name: "value"; type: "QVariant" } @@ -244,6 +271,7 @@ Module { "QtQml/Component 2.0", "QtQuick/Component 2.0" ] + exportMetaObjectRevisions: [0, 0, 0] attachedType: "QQmlComponentAttached" Enum { name: "CompilationMode" @@ -298,13 +326,105 @@ Module { name: "QQmlConnections" prototype: "QObject" exports: ["QtQml/Connections 2.0", "QtQuick/Connections 2.0"] + exportMetaObjectRevisions: [0, 0] Property { name: "target"; type: "QObject"; isPointer: true } Property { name: "ignoreUnknownSignals"; type: "bool" } } Component { + name: "QQmlDelegateModel" + defaultProperty: "delegate" + prototype: "QQmlInstanceModel" + exports: ["QtQuick/VisualDataModel 2.0"] + exportMetaObjectRevisions: [0] + attachedType: "QQmlDelegateModelAttached" + Property { name: "model"; type: "QVariant" } + Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "filterOnGroup"; type: "string" } + Property { name: "items"; type: "QQmlDelegateModelGroup"; isReadonly: true; isPointer: true } + Property { + name: "persistedItems" + type: "QQmlDelegateModelGroup" + isReadonly: true + isPointer: true + } + Property { name: "groups"; type: "QQmlDelegateModelGroup"; isList: true; isReadonly: true } + Property { name: "parts"; type: "QObject"; isReadonly: true; isPointer: true } + Property { name: "rootIndex"; type: "QVariant" } + Signal { name: "filterGroupChanged" } + Signal { name: "defaultGroupsChanged" } + Method { + name: "modelIndex" + type: "QVariant" + Parameter { name: "idx"; type: "int" } + } + Method { name: "parentModelIndex"; type: "QVariant" } + } + Component { + name: "QQmlDelegateModelAttached" + prototype: "QObject" + Property { name: "model"; type: "QQmlDelegateModel"; isReadonly: true; isPointer: true } + Property { name: "groups"; type: "QStringList" } + Property { name: "isUnresolved"; type: "bool"; isReadonly: true } + Signal { name: "unresolvedChanged" } + } + Component { + name: "QQmlDelegateModelGroup" + prototype: "QObject" + exports: ["QtQuick/VisualDataGroup 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "count"; type: "int"; isReadonly: true } + Property { name: "name"; type: "string" } + Property { name: "includeByDefault"; type: "bool" } + Signal { name: "defaultIncludeChanged" } + Signal { + name: "changed" + Parameter { name: "removed"; type: "QQmlV8Handle" } + Parameter { name: "inserted"; type: "QQmlV8Handle" } + } + Method { + name: "insert" + Parameter { type: "QQmlV8Function"; isPointer: true } + } + Method { + name: "create" + Parameter { type: "QQmlV8Function"; isPointer: true } + } + Method { + name: "resolve" + Parameter { type: "QQmlV8Function"; isPointer: true } + } + Method { + name: "remove" + Parameter { type: "QQmlV8Function"; isPointer: true } + } + Method { + name: "addGroups" + Parameter { type: "QQmlV8Function"; isPointer: true } + } + Method { + name: "removeGroups" + Parameter { type: "QQmlV8Function"; isPointer: true } + } + Method { + name: "setGroups" + Parameter { type: "QQmlV8Function"; isPointer: true } + } + Method { + name: "move" + Parameter { type: "QQmlV8Function"; isPointer: true } + } + Method { + name: "get" + type: "QQmlV8Handle" + Parameter { name: "index"; type: "int" } + } + } + Component { name: "QQmlDelegateModelParts"; prototype: "QObject" } + Component { name: "QQmlEasingValueType" prototype: "QQmlValueType" exports: ["QtQuick/Easing 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "Type" values: { @@ -363,8 +483,111 @@ Module { Property { name: "bezierCurve"; type: "QVariantList" } } Component { + name: "QQmlInstanceModel" + prototype: "QObject" + Property { name: "count"; type: "int"; isReadonly: true } + Signal { + name: "modelUpdated" + Parameter { name: "changeSet"; type: "QQmlChangeSet" } + Parameter { name: "reset"; type: "bool" } + } + Signal { + name: "createdItem" + Parameter { name: "index"; type: "int" } + Parameter { name: "object"; type: "QObject"; isPointer: true } + } + Signal { + name: "initItem" + Parameter { name: "index"; type: "int" } + Parameter { name: "object"; type: "QObject"; isPointer: true } + } + Signal { + name: "destroyingItem" + Parameter { name: "object"; type: "QObject"; isPointer: true } + } + } + Component { + name: "QQmlInstantiator" + defaultProperty: "delegate" + prototype: "QObject" + exports: ["QtQml/Instantiator 2.1", "QtQuick/Instantiator 2.1"] + exportMetaObjectRevisions: [0, 0] + Property { name: "active"; type: "bool" } + Property { name: "asynchronous"; type: "bool" } + Property { name: "model"; type: "QVariant" } + Property { name: "count"; type: "int"; isReadonly: true } + Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } + Property { name: "object"; type: "QObject"; isReadonly: true; isPointer: true } + Signal { + name: "objectAdded" + Parameter { name: "index"; type: "int" } + Parameter { name: "object"; type: "QObject"; isPointer: true } + } + Signal { + name: "objectRemoved" + Parameter { name: "index"; type: "int" } + Parameter { name: "object"; type: "QObject"; isPointer: true } + } + Method { + name: "objectAt" + type: "QObject*" + Parameter { name: "index"; type: "int" } + } + } + Component { + name: "QQmlListElement" + prototype: "QObject" + exports: ["QtQuick/ListElement 2.0"] + exportMetaObjectRevisions: [0] + } + Component { + name: "QQmlListModel" + prototype: "QAbstractListModel" + exports: ["QtQuick/ListModel 2.0"] + exportMetaObjectRevisions: [0] + Property { name: "count"; type: "int"; isReadonly: true } + Property { name: "dynamicRoles"; type: "bool" } + Method { name: "clear" } + Method { + name: "remove" + Parameter { name: "args"; type: "QQmlV8Function"; isPointer: true } + } + Method { + name: "append" + Parameter { name: "args"; type: "QQmlV8Function"; isPointer: true } + } + Method { + name: "insert" + Parameter { name: "args"; type: "QQmlV8Function"; isPointer: true } + } + Method { + name: "get" + type: "QQmlV8Handle" + Parameter { name: "index"; type: "int" } + } + Method { + name: "set" + Parameter { name: "index"; type: "int" } + Parameter { type: "QQmlV8Handle" } + } + Method { + name: "setProperty" + Parameter { name: "index"; type: "int" } + Parameter { name: "property"; type: "string" } + Parameter { name: "value"; type: "QVariant" } + } + Method { + name: "move" + Parameter { name: "from"; type: "int" } + Parameter { name: "to"; type: "int" } + Parameter { name: "count"; type: "int" } + } + Method { name: "sync" } + } + Component { name: "QQmlLocale" exports: ["QtQuick/Locale 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "MeasurementSystem" values: { @@ -404,9 +627,24 @@ Module { } } Component { + name: "QQmlObjectModel" + defaultProperty: "children" + prototype: "QQmlInstanceModel" + exports: ["QtQuick/VisualItemModel 2.0"] + exportMetaObjectRevisions: [0] + attachedType: "QQmlObjectModelAttached" + Property { name: "children"; type: "QObject"; isList: true; isReadonly: true } + } + Component { + name: "QQmlObjectModelAttached" + prototype: "QObject" + Property { name: "index"; type: "int"; isReadonly: true } + } + Component { name: "QQmlTimer" prototype: "QObject" exports: ["QtQml/Timer 2.0", "QtQuick/Timer 2.0"] + exportMetaObjectRevisions: [0, 0] Property { name: "interval"; type: "int" } Property { name: "running"; type: "bool" } Property { name: "repeat"; type: "bool" } @@ -422,6 +660,7 @@ Module { name: "QQuickAbstractAnimation" prototype: "QObject" exports: ["QtQuick/Animation 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "Loops" values: { @@ -461,14 +700,18 @@ Module { name: "QQuickAccessibleAttached" prototype: "QObject" exports: ["QtQuick/Accessible 2.0"] + exportMetaObjectRevisions: [0] Property { name: "role"; type: "QAccessible::Role" } Property { name: "name"; type: "string" } Property { name: "description"; type: "string" } + Method { name: "valueChanged" } + Method { name: "cursorPositionChanged" } } Component { name: "QQuickAnchorAnimation" prototype: "QQuickAbstractAnimation" exports: ["QtQuick/AnchorAnimation 2.0"] + exportMetaObjectRevisions: [0] Property { name: "targets"; type: "QQuickItem"; isList: true; isReadonly: true } Property { name: "duration"; type: "int" } Property { name: "easing"; type: "QEasingCurve" } @@ -485,6 +728,7 @@ Module { name: "QQuickAnchorChanges" prototype: "QQuickStateOperation" exports: ["QtQuick/AnchorChanges 2.0"] + exportMetaObjectRevisions: [0] Property { name: "target"; type: "QQuickItem"; isPointer: true } Property { name: "anchors"; type: "QQuickAnchorSet"; isReadonly: true; isPointer: true } } @@ -527,6 +771,7 @@ Module { defaultProperty: "data" prototype: "QQuickImage" exports: ["QtQuick/AnimatedImage 2.0"] + exportMetaObjectRevisions: [0] Property { name: "playing"; type: "bool" } Property { name: "paused"; type: "bool" } Property { name: "currentFrame"; type: "int" } @@ -539,6 +784,7 @@ Module { defaultProperty: "data" prototype: "QQuickItem" exports: ["QtQuick/AnimatedSprite 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "LoopParameters" values: { @@ -698,6 +944,7 @@ Module { defaultProperty: "animation" prototype: "QObject" exports: ["QtQuick/AnimationController 2.0"] + exportMetaObjectRevisions: [0] Property { name: "progress"; type: "double" } Property { name: "animation"; type: "QQuickAbstractAnimation"; isPointer: true } Method { name: "reload" } @@ -712,8 +959,9 @@ Module { } Component { name: "QQuickApplication" - prototype: "QObject" + prototype: "QQmlApplication" exports: ["QtQuick/Application 2.0"] + exportMetaObjectRevisions: [0] Property { name: "active"; type: "bool"; isReadonly: true } Property { name: "layoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true } Property { name: "supportsMultipleWindows"; type: "bool"; isReadonly: true } @@ -723,6 +971,7 @@ Module { defaultProperty: "data" prototype: "QQuickImplicitSizeItem" exports: ["QtQuick/Positioner 2.0"] + exportMetaObjectRevisions: [0] attachedType: "QQuickPositionerAttached" Property { name: "spacing"; type: "double" } Property { name: "populate"; type: "QQuickTransition"; isPointer: true } @@ -734,6 +983,7 @@ Module { defaultProperty: "animation" prototype: "QObject" exports: ["QtQuick/Behavior 2.0"] + exportMetaObjectRevisions: [0] Property { name: "animation"; type: "QQuickAbstractAnimation"; isPointer: true } Property { name: "enabled"; type: "bool" } } @@ -742,6 +992,7 @@ Module { defaultProperty: "data" prototype: "QQuickImageBase" exports: ["QtQuick/BorderImage 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "TileMode" values: { @@ -760,6 +1011,7 @@ Module { defaultProperty: "data" prototype: "QQuickItem" exports: ["QtQuick/Canvas 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "RenderTarget" values: { @@ -846,6 +1098,7 @@ Module { name: "QQuickColorAnimation" prototype: "QQuickPropertyAnimation" exports: ["QtQuick/ColorAnimation 2.0"] + exportMetaObjectRevisions: [0] Property { name: "from"; type: "QColor" } Property { name: "to"; type: "QColor" } } @@ -854,6 +1107,7 @@ Module { defaultProperty: "data" prototype: "QQuickBasePositioner" exports: ["QtQuick/Column 2.0"] + exportMetaObjectRevisions: [0] } Component { name: "QQuickCurve" @@ -867,6 +1121,7 @@ Module { name: "QQuickDoubleValidator" prototype: "QDoubleValidator" exports: ["QtQuick/DoubleValidator 2.0"] + exportMetaObjectRevisions: [0] Property { name: "locale"; type: "string" } Signal { name: "localeNameChanged" } } @@ -874,13 +1129,15 @@ Module { name: "QQuickDrag" prototype: "QObject" exports: ["QtQuick/Drag 2.0"] + exportMetaObjectRevisions: [0] attachedType: "QQuickDragAttached" Enum { name: "Axis" values: { "XAxis": 1, "YAxis": 2, - "XAndYAxis": 3 + "XAndYAxis": 3, + "XandYAxis": 3 } } Property { name: "target"; type: "QQuickItem"; isPointer: true } @@ -914,6 +1171,7 @@ Module { defaultProperty: "data" prototype: "QQuickItem" exports: ["QtQuick/DropArea 2.0"] + exportMetaObjectRevisions: [0] Property { name: "containsDrag"; type: "bool"; isReadonly: true } Property { name: "keys"; type: "QStringList" } Property { name: "drag"; type: "QQuickDropAreaDrag"; isReadonly: true; isPointer: true } @@ -945,6 +1203,7 @@ Module { defaultProperty: "flickableData" prototype: "QQuickItem" exports: ["QtQuick/Flickable 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "BoundsBehavior" values: { @@ -1054,6 +1313,7 @@ Module { defaultProperty: "data" prototype: "QQuickItem" exports: ["QtQuick/Flipable 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "Side" values: { @@ -1070,6 +1330,7 @@ Module { defaultProperty: "data" prototype: "QQuickBasePositioner" exports: ["QtQuick/Flow 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "Flow" values: { @@ -1086,11 +1347,13 @@ Module { defaultProperty: "data" prototype: "QQuickItem" exports: ["QtQuick/FocusScope 2.0"] + exportMetaObjectRevisions: [0] } Component { name: "QQuickFontLoader" prototype: "QObject" exports: ["QtQuick/FontLoader 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "Status" values: { @@ -1108,6 +1371,7 @@ Module { name: "QQuickFontValueType" prototype: "QQmlValueType" exports: ["QtQuick/Font 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "FontWeight" values: { @@ -1146,6 +1410,7 @@ Module { defaultProperty: "stops" prototype: "QObject" exports: ["QtQuick/Gradient 2.0"] + exportMetaObjectRevisions: [0] Property { name: "stops"; type: "QQuickGradientStop"; isList: true; isReadonly: true } Signal { name: "updated" } } @@ -1153,6 +1418,7 @@ Module { name: "QQuickGradientStop" prototype: "QObject" exports: ["QtQuick/GradientStop 2.0"] + exportMetaObjectRevisions: [0] Property { name: "position"; type: "double" } Property { name: "color"; type: "QColor" } } @@ -1160,7 +1426,8 @@ Module { name: "QQuickGrid" defaultProperty: "data" prototype: "QQuickBasePositioner" - exports: ["QtQuick/Grid 2.0"] + exports: ["QtQuick/Grid 2.0", "QtQuick/Grid 2.1"] + exportMetaObjectRevisions: [0, 1] Enum { name: "Flow" values: { @@ -1168,6 +1435,22 @@ Module { "TopToBottom": 1 } } + Enum { + name: "HAlignment" + values: { + "AlignLeft": 1, + "AlignRight": 2, + "AlignHCenter": 4 + } + } + Enum { + name: "VAlignment" + values: { + "AlignTop": 32, + "AlignBottom": 64, + "AlignVCenter": 128 + } + } Property { name: "rows"; type: "int" } Property { name: "columns"; type: "int" } Property { name: "rowSpacing"; type: "double" } @@ -1175,18 +1458,43 @@ Module { Property { name: "flow"; type: "Flow" } Property { name: "layoutDirection"; type: "Qt::LayoutDirection" } Property { name: "effectiveLayoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true } + Property { name: "horizontalItemAlignment"; revision: 1; type: "HAlignment" } + Property { + name: "effectiveHorizontalItemAlignment" + revision: 1 + type: "HAlignment" + isReadonly: true + } + Property { name: "verticalItemAlignment"; revision: 1; type: "VAlignment" } + Signal { + name: "horizontalAlignmentChanged" + revision: 1 + Parameter { name: "alignment"; type: "HAlignment" } + } + Signal { + name: "effectiveHorizontalAlignmentChanged" + revision: 1 + Parameter { name: "alignment"; type: "HAlignment" } + } + Signal { + name: "verticalAlignmentChanged" + revision: 1 + Parameter { name: "alignment"; type: "VAlignment" } + } } Component { name: "QQuickGridMesh" prototype: "QQuickShaderEffectMesh" exports: ["QtQuick/GridMesh 2.0"] + exportMetaObjectRevisions: [0] Property { name: "resolution"; type: "QSize" } } Component { name: "QQuickGridView" defaultProperty: "data" prototype: "QQuickItemView" - exports: ["QtQuick/GridView 2.0"] + exports: ["QtQuick/GridView 2.0", "QtQuick/GridView 2.1"] + exportMetaObjectRevisions: [0, 1] attachedType: "QQuickGridViewAttached" Enum { name: "Flow" @@ -1223,6 +1531,7 @@ Module { defaultProperty: "data" prototype: "QQuickImageBase" exports: ["QtQuick/Image 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "HAlignment" values: { @@ -1305,11 +1614,14 @@ Module { prototype: "QQuickItem" Property { name: "implicitWidth"; type: "double"; isReadonly: true } Property { name: "implicitHeight"; type: "double"; isReadonly: true } + Signal { name: "implicitWidthChanged2"; revision: 1 } + Signal { name: "implicitHeightChanged2"; revision: 1 } } Component { name: "QQuickIntValidator" prototype: "QIntValidator" exports: ["QtQuick/IntValidator 2.0"] + exportMetaObjectRevisions: [0] Property { name: "locale"; type: "string" } Signal { name: "localeNameChanged" } } @@ -1317,7 +1629,8 @@ Module { name: "QQuickItem" defaultProperty: "data" prototype: "QObject" - exports: ["QtQuick/Item 2.0"] + exports: ["QtQuick/Item 2.0", "QtQuick/Item 2.1"] + exportMetaObjectRevisions: [0, 1] Enum { name: "TransformOrigin" values: { @@ -1361,6 +1674,7 @@ Module { Property { name: "clip"; type: "bool" } Property { name: "focus"; type: "bool" } Property { name: "activeFocus"; type: "bool"; isReadonly: true } + Property { name: "activeFocusOnTab"; revision: 1; type: "bool" } Property { name: "rotation"; type: "double" } Property { name: "scale"; type: "double" } Property { name: "transformOrigin"; type: "TransformOrigin" } @@ -1392,6 +1706,11 @@ Module { Parameter { type: "bool" } } Signal { + name: "activeFocusOnTabChanged" + revision: 1 + Parameter { type: "bool" } + } + Signal { name: "parentChanged" Parameter { type: "QQuickItem"; isPointer: true } } @@ -1411,6 +1730,11 @@ Module { name: "clipChanged" Parameter { type: "bool" } } + Signal { + name: "windowChanged" + revision: 1 + Parameter { name: "window"; type: "QQuickWindow"; isPointer: true } + } Method { name: "update" } Method { name: "contains" @@ -1427,6 +1751,16 @@ Module { } Method { name: "forceActiveFocus" } Method { + name: "forceActiveFocus" + Parameter { name: "reason"; type: "Qt::FocusReason" } + } + Method { + name: "nextItemInFocusChain" + type: "QQuickItem*" + Parameter { name: "forward"; type: "bool" } + } + Method { name: "nextItemInFocusChain"; type: "QQuickItem*" } + Method { name: "childAt" type: "QQuickItem*" Parameter { name: "x"; type: "double" } @@ -1486,6 +1820,8 @@ Module { name: "QQuickItemView" defaultProperty: "flickableData" prototype: "QQuickFlickable" + exports: ["QtQuick/ItemView 2.1"] + exportMetaObjectRevisions: [1] Enum { name: "LayoutDirection" values: { @@ -1577,6 +1913,7 @@ Module { } Method { name: "positionViewAtBeginning" } Method { name: "positionViewAtEnd" } + Method { name: "forceLayout"; revision: 1 } } Component { name: "QQuickItemViewAttached" @@ -1595,6 +1932,7 @@ Module { name: "QQuickKeyNavigationAttached" prototype: "QObject" exports: ["QtQuick/KeyNavigation 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "Priority" values: { @@ -1614,6 +1952,7 @@ Module { name: "QQuickKeysAttached" prototype: "QObject" exports: ["QtQuick/Keys 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "Priority" values: { @@ -1789,62 +2128,16 @@ Module { name: "QQuickLayoutMirroringAttached" prototype: "QObject" exports: ["QtQuick/LayoutMirroring 2.0"] + exportMetaObjectRevisions: [0] Property { name: "enabled"; type: "bool" } Property { name: "childrenInherit"; type: "bool" } } Component { - name: "QQuickListElement" - prototype: "QObject" - exports: ["QtQuick/ListElement 2.0"] - } - Component { - name: "QQuickListModel" - prototype: "QAbstractListModel" - exports: ["QtQuick/ListModel 2.0"] - Property { name: "count"; type: "int"; isReadonly: true } - Property { name: "dynamicRoles"; type: "bool" } - Method { name: "clear" } - Method { - name: "remove" - Parameter { name: "args"; type: "QQmlV8Function"; isPointer: true } - } - Method { - name: "append" - Parameter { name: "args"; type: "QQmlV8Function"; isPointer: true } - } - Method { - name: "insert" - Parameter { name: "args"; type: "QQmlV8Function"; isPointer: true } - } - Method { - name: "get" - type: "QQmlV8Handle" - Parameter { name: "index"; type: "int" } - } - Method { - name: "set" - Parameter { name: "index"; type: "int" } - Parameter { type: "QQmlV8Handle" } - } - Method { - name: "setProperty" - Parameter { name: "index"; type: "int" } - Parameter { name: "property"; type: "string" } - Parameter { name: "value"; type: "QVariant" } - } - Method { - name: "move" - Parameter { name: "from"; type: "int" } - Parameter { name: "to"; type: "int" } - Parameter { name: "count"; type: "int" } - } - Method { name: "sync" } - } - Component { name: "QQuickListView" defaultProperty: "data" prototype: "QQuickItemView" - exports: ["QtQuick/ListView 2.0"] + exports: ["QtQuick/ListView 2.0", "QtQuick/ListView 2.1"] + exportMetaObjectRevisions: [0, 1] attachedType: "QQuickListViewAttached" Enum { name: "Orientation" @@ -1882,6 +2175,7 @@ Module { defaultProperty: "data" prototype: "QQuickImplicitSizeItem" exports: ["QtQuick/Loader 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "Status" values: { @@ -1909,6 +2203,7 @@ Module { defaultProperty: "data" prototype: "QQuickItem" exports: ["QtQuick/MouseArea 2.0"] + exportMetaObjectRevisions: [0] Property { name: "mouseX"; type: "double"; isReadonly: true } Property { name: "mouseY"; type: "double"; isReadonly: true } Property { name: "containsMouse"; type: "bool"; isReadonly: true } @@ -1979,6 +2274,7 @@ Module { defaultProperty: "data" prototype: "QQuickItem" exports: ["QtQuick/MultiPointTouchArea 2.0"] + exportMetaObjectRevisions: [0] Property { name: "touchPoints"; type: "QQuickTouchPoint"; isList: true; isReadonly: true } Property { name: "minimumTouchPoints"; type: "int" } Property { name: "maximumTouchPoints"; type: "int" } @@ -2011,6 +2307,7 @@ Module { name: "QQuickNumberAnimation" prototype: "QQuickPropertyAnimation" exports: ["QtQuick/NumberAnimation 2.0"] + exportMetaObjectRevisions: [0] Property { name: "from"; type: "double" } Property { name: "to"; type: "double" } } @@ -2019,6 +2316,7 @@ Module { defaultProperty: "data" prototype: "QObject" exports: ["QtQuick/Package 2.0"] + exportMetaObjectRevisions: [0] attachedType: "QQuickPackageAttached" Property { name: "data"; type: "QObject"; isList: true; isReadonly: true } } @@ -2032,6 +2330,7 @@ Module { defaultProperty: "data" prototype: "QQuickItem" exports: ["QtQuick/PaintedItem 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "RenderTarget" values: { @@ -2050,12 +2349,14 @@ Module { defaultProperty: "animations" prototype: "QQuickAnimationGroup" exports: ["QtQuick/ParallelAnimation 2.0"] + exportMetaObjectRevisions: [0] } Component { name: "QQuickParentAnimation" defaultProperty: "animations" prototype: "QQuickAnimationGroup" exports: ["QtQuick/ParentAnimation 2.0"] + exportMetaObjectRevisions: [0] Property { name: "target"; type: "QQuickItem"; isPointer: true } Property { name: "newParent"; type: "QQuickItem"; isPointer: true } Property { name: "via"; type: "QQuickItem"; isPointer: true } @@ -2064,6 +2365,7 @@ Module { name: "QQuickParentChange" prototype: "QQuickStateOperation" exports: ["QtQuick/ParentChange 2.0"] + exportMetaObjectRevisions: [0] Property { name: "target"; type: "QQuickItem"; isPointer: true } Property { name: "parent"; type: "QQuickItem"; isPointer: true } Property { name: "x"; type: "QQmlScriptString" } @@ -2078,6 +2380,7 @@ Module { defaultProperty: "pathElements" prototype: "QObject" exports: ["QtQuick/Path 2.0"] + exportMetaObjectRevisions: [0] Property { name: "pathElements"; type: "QQuickPathElement"; isList: true; isReadonly: true } Property { name: "startX"; type: "double" } Property { name: "startY"; type: "double" } @@ -2088,6 +2391,7 @@ Module { name: "QQuickPathAnimation" prototype: "QQuickAbstractAnimation" exports: ["QtQuick/PathAnimation 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "Orientation" values: { @@ -2140,6 +2444,7 @@ Module { name: "QQuickPathArc" prototype: "QQuickCurve" exports: ["QtQuick/PathArc 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "ArcDirection" values: { @@ -2156,6 +2461,7 @@ Module { name: "QQuickPathAttribute" prototype: "QQuickPathElement" exports: ["QtQuick/PathAttribute 2.0"] + exportMetaObjectRevisions: [0] Property { name: "name"; type: "string" } Property { name: "value"; type: "double" } } @@ -2163,11 +2469,13 @@ Module { name: "QQuickPathCatmullRomCurve" prototype: "QQuickCurve" exports: ["QtQuick/PathCurve 2.0"] + exportMetaObjectRevisions: [0] } Component { name: "QQuickPathCubic" prototype: "QQuickCurve" exports: ["QtQuick/PathCubic 2.0"] + exportMetaObjectRevisions: [0] Property { name: "control1X"; type: "double" } Property { name: "control1Y"; type: "double" } Property { name: "control2X"; type: "double" } @@ -2186,6 +2494,7 @@ Module { name: "QQuickPathInterpolator" prototype: "QObject" exports: ["QtQuick/PathInterpolator 2.0"] + exportMetaObjectRevisions: [0] Property { name: "path"; type: "QQuickPath"; isPointer: true } Property { name: "progress"; type: "double" } Property { name: "x"; type: "double"; isReadonly: true } @@ -2196,17 +2505,20 @@ Module { name: "QQuickPathLine" prototype: "QQuickCurve" exports: ["QtQuick/PathLine 2.0"] + exportMetaObjectRevisions: [0] } Component { name: "QQuickPathPercent" prototype: "QQuickPathElement" exports: ["QtQuick/PathPercent 2.0"] + exportMetaObjectRevisions: [0] Property { name: "value"; type: "double" } } Component { name: "QQuickPathQuad" prototype: "QQuickCurve" exports: ["QtQuick/PathQuad 2.0"] + exportMetaObjectRevisions: [0] Property { name: "controlX"; type: "double" } Property { name: "controlY"; type: "double" } Property { name: "relativeControlX"; type: "double" } @@ -2216,6 +2528,7 @@ Module { name: "QQuickPathSvg" prototype: "QQuickCurve" exports: ["QtQuick/PathSvg 2.0"] + exportMetaObjectRevisions: [0] Property { name: "path"; type: "string" } } Component { @@ -2223,6 +2536,7 @@ Module { defaultProperty: "data" prototype: "QQuickItem" exports: ["QtQuick/PathView 2.0"] + exportMetaObjectRevisions: [0] attachedType: "QQuickPathViewAttached" Enum { name: "HighlightRangeMode" @@ -2313,6 +2627,7 @@ Module { name: "QQuickPauseAnimation" prototype: "QQuickAbstractAnimation" exports: ["QtQuick/PauseAnimation 2.0"] + exportMetaObjectRevisions: [0] Property { name: "duration"; type: "int" } Signal { name: "durationChanged" @@ -2331,13 +2646,15 @@ Module { name: "QQuickPinch" prototype: "QObject" exports: ["QtQuick/Pinch 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "Axis" values: { "NoDrag": 0, "XAxis": 1, "YAxis": 2, - "XAndYAxis": 3 + "XAndYAxis": 3, + "XandYAxis": 3 } } Property { name: "target"; type: "QQuickItem"; isPointer: true } @@ -2357,6 +2674,7 @@ Module { defaultProperty: "data" prototype: "QQuickItem" exports: ["QtQuick/PinchArea 2.0"] + exportMetaObjectRevisions: [0] Property { name: "enabled"; type: "bool" } Property { name: "pinch"; type: "QQuickPinch"; isReadonly: true; isPointer: true } Signal { @@ -2383,6 +2701,7 @@ Module { name: "QQuickPropertyAction" prototype: "QQuickAbstractAnimation" exports: ["QtQuick/PropertyAction 2.0"] + exportMetaObjectRevisions: [0] Property { name: "target"; type: "QObject"; isPointer: true } Property { name: "property"; type: "string" } Property { name: "properties"; type: "string" } @@ -2402,6 +2721,7 @@ Module { name: "QQuickPropertyAnimation" prototype: "QQuickAbstractAnimation" exports: ["QtQuick/PropertyAnimation 2.0"] + exportMetaObjectRevisions: [0] Property { name: "duration"; type: "int" } Property { name: "from"; type: "QVariant" } Property { name: "to"; type: "QVariant" } @@ -2436,6 +2756,7 @@ Module { name: "QQuickPropertyChanges" prototype: "QQuickStateOperation" exports: ["QtQuick/PropertyChanges 2.0"] + exportMetaObjectRevisions: [0] Property { name: "target"; type: "QObject"; isPointer: true } Property { name: "restoreEntryValues"; type: "bool" } Property { name: "explicit"; type: "bool" } @@ -2445,6 +2766,7 @@ Module { defaultProperty: "data" prototype: "QQuickItem" exports: ["QtQuick/Rectangle 2.0"] + exportMetaObjectRevisions: [0] Property { name: "color"; type: "QColor" } Property { name: "gradient"; type: "QQuickGradient"; isPointer: true } Property { name: "border"; type: "QQuickPen"; isReadonly: true; isPointer: true } @@ -2455,6 +2777,7 @@ Module { defaultProperty: "delegate" prototype: "QQuickItem" exports: ["QtQuick/Repeater 2.0"] + exportMetaObjectRevisions: [0] Property { name: "model"; type: "QVariant" } Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } Property { name: "count"; type: "int"; isReadonly: true } @@ -2478,6 +2801,7 @@ Module { name: "QQuickRotation" prototype: "QQuickTransform" exports: ["QtQuick/Rotation 2.0"] + exportMetaObjectRevisions: [0] Property { name: "origin"; type: "QVector3D" } Property { name: "angle"; type: "double" } Property { name: "axis"; type: "QVector3D" } @@ -2486,6 +2810,7 @@ Module { name: "QQuickRotationAnimation" prototype: "QQuickPropertyAnimation" exports: ["QtQuick/RotationAnimation 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "RotationDirection" values: { @@ -2504,6 +2829,7 @@ Module { defaultProperty: "data" prototype: "QQuickBasePositioner" exports: ["QtQuick/Row 2.0"] + exportMetaObjectRevisions: [0] Property { name: "layoutDirection"; type: "Qt::LayoutDirection" } Property { name: "effectiveLayoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true } } @@ -2511,6 +2837,7 @@ Module { name: "QQuickScale" prototype: "QQuickTransform" exports: ["QtQuick/Scale 2.0"] + exportMetaObjectRevisions: [0] Property { name: "origin"; type: "QVector3D" } Property { name: "xScale"; type: "double" } Property { name: "yScale"; type: "double" } @@ -2530,6 +2857,7 @@ Module { name: "QQuickScriptAction" prototype: "QQuickAbstractAnimation" exports: ["QtQuick/ScriptAction 2.0"] + exportMetaObjectRevisions: [0] Property { name: "script"; type: "QQmlScriptString" } Property { name: "scriptName"; type: "string" } } @@ -2538,12 +2866,14 @@ Module { defaultProperty: "animations" prototype: "QQuickAnimationGroup" exports: ["QtQuick/SequentialAnimation 2.0"] + exportMetaObjectRevisions: [0] } Component { name: "QQuickShaderEffect" defaultProperty: "data" prototype: "QQuickItem" exports: ["QtQuick/ShaderEffect 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "CullMode" values: { @@ -2572,6 +2902,7 @@ Module { name: "QQuickShaderEffectMesh" prototype: "QObject" exports: ["QtQuick/ShaderEffectMesh 2.0"] + exportMetaObjectRevisions: [0] Signal { name: "geometryChanged" } } Component { @@ -2579,6 +2910,7 @@ Module { defaultProperty: "data" prototype: "QQuickItem" exports: ["QtQuick/ShaderEffectSource 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "WrapMode" values: { @@ -2612,6 +2944,7 @@ Module { name: "QQuickSmoothedAnimation" prototype: "QQuickNumberAnimation" exports: ["QtQuick/SmoothedAnimation 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "ReversingMode" values: { @@ -2628,6 +2961,7 @@ Module { name: "QQuickSpringAnimation" prototype: "QQuickNumberAnimation" exports: ["QtQuick/SpringAnimation 2.0"] + exportMetaObjectRevisions: [0] Property { name: "velocity"; type: "double" } Property { name: "spring"; type: "double" } Property { name: "damping"; type: "double" } @@ -2640,6 +2974,7 @@ Module { name: "QQuickSprite" prototype: "QQuickStochasticState" exports: ["QtQuick/Sprite 2.0"] + exportMetaObjectRevisions: [0] Property { name: "source"; type: "QUrl" } Property { name: "reverse"; type: "bool" } Property { name: "frameSync"; type: "bool" } @@ -2759,6 +3094,7 @@ Module { defaultProperty: "sprites" prototype: "QQuickItem" exports: ["QtQuick/SpriteSequence 2.0"] + exportMetaObjectRevisions: [0] Property { name: "running"; type: "bool" } Property { name: "interpolate"; type: "bool" } Property { name: "goalSprite"; type: "string" } @@ -2802,6 +3138,7 @@ Module { defaultProperty: "changes" prototype: "QObject" exports: ["QtQuick/State 2.0"] + exportMetaObjectRevisions: [0] Property { name: "name"; type: "string" } Property { name: "when"; type: "QQmlBinding"; isPointer: true } Property { name: "extend"; type: "string" } @@ -2812,6 +3149,7 @@ Module { name: "QQuickStateChangeScript" prototype: "QQuickStateOperation" exports: ["QtQuick/StateChangeScript 2.0"] + exportMetaObjectRevisions: [0] Property { name: "script"; type: "QQmlScriptString" } Property { name: "name"; type: "string" } } @@ -2819,6 +3157,7 @@ Module { name: "QQuickStateGroup" prototype: "QObject" exports: ["QtQuick/StateGroup 2.0"] + exportMetaObjectRevisions: [0] Property { name: "state"; type: "string" } Property { name: "states"; type: "QQuickState"; isList: true; isReadonly: true } Property { name: "transitions"; type: "QQuickTransition"; isList: true; isReadonly: true } @@ -2882,6 +3221,7 @@ Module { name: "QQuickSystemPalette" prototype: "QObject" exports: ["QtQuick/SystemPalette 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "ColorGroup" values: { @@ -2912,6 +3252,7 @@ Module { defaultProperty: "data" prototype: "QQuickImplicitSizeItem" exports: ["QtQuick/Text 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "HAlignment" values: { @@ -3062,11 +3403,13 @@ Module { } Method { name: "doLayout" } } + Component { name: "QQuickTextDocument"; prototype: "QObject" } Component { name: "QQuickTextEdit" defaultProperty: "data" prototype: "QQuickImplicitSizeItem" - exports: ["QtQuick/TextEdit 2.0"] + exports: ["QtQuick/TextEdit 2.0", "QtQuick/TextEdit 2.1"] + exportMetaObjectRevisions: [0, 1] Enum { name: "HAlignment" values: { @@ -3144,6 +3487,7 @@ Module { Property { name: "persistentSelection"; type: "bool" } Property { name: "textMargin"; type: "double" } Property { name: "inputMethodHints"; type: "Qt::InputMethodHints" } + Property { name: "selectByKeyboard"; revision: 1; type: "bool" } Property { name: "selectByMouse"; type: "bool" } Property { name: "mouseSelectionMode"; type: "SelectionMode" } Property { name: "canPaste"; type: "bool"; isReadonly: true } @@ -3152,6 +3496,13 @@ Module { Property { name: "inputMethodComposing"; type: "bool"; isReadonly: true } Property { name: "baseUrl"; type: "QUrl" } Property { name: "renderType"; type: "RenderType" } + Property { + name: "textDocument" + revision: 1 + type: "QQuickTextDocument" + isReadonly: true + isPointer: true + } Signal { name: "contentSizeChanged" } Signal { name: "colorChanged" @@ -3202,6 +3553,11 @@ Module { Parameter { name: "textMargin"; type: "double" } } Signal { + name: "selectByKeyboardChanged" + revision: 1 + Parameter { name: "selectByKeyboard"; type: "bool" } + } + Signal { name: "selectByMouseChanged" Parameter { name: "selectByMouse"; type: "bool" } } @@ -3280,6 +3636,7 @@ Module { defaultProperty: "data" prototype: "QQuickImplicitSizeItem" exports: ["QtQuick/TextInput 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "EchoMode" values: { @@ -3482,6 +3839,7 @@ Module { name: "QQuickTouchPoint" prototype: "QObject" exports: ["QtQuick/TouchPoint 2.0"] + exportMetaObjectRevisions: [0] Property { name: "pointId"; type: "int"; isReadonly: true } Property { name: "pressed"; type: "bool"; isReadonly: true } Property { name: "x"; type: "double"; isReadonly: true } @@ -3502,6 +3860,7 @@ Module { defaultProperty: "animations" prototype: "QObject" exports: ["QtQuick/Transition 2.0"] + exportMetaObjectRevisions: [0] Property { name: "from"; type: "string" } Property { name: "to"; type: "string" } Property { name: "reversible"; type: "bool" } @@ -3513,6 +3872,7 @@ Module { name: "QQuickTranslate" prototype: "QQuickTransform" exports: ["QtQuick/Translate 2.0"] + exportMetaObjectRevisions: [0] Property { name: "x"; type: "double" } Property { name: "y"; type: "double" } } @@ -3520,6 +3880,7 @@ Module { name: "QQuickVector3dAnimation" prototype: "QQuickPropertyAnimation" exports: ["QtQuick/Vector3dAnimation 2.0"] + exportMetaObjectRevisions: [0] Property { name: "from"; type: "QVector3D" } Property { name: "to"; type: "QVector3D" } } @@ -3527,6 +3888,7 @@ Module { name: "QQuickViewSection" prototype: "QObject" exports: ["QtQuick/ViewSection 2.0"] + exportMetaObjectRevisions: [0] Enum { name: "SectionCriteria" values: { @@ -3552,6 +3914,7 @@ Module { name: "QQuickViewTransitionAttached" prototype: "QObject" exports: ["QtQuick/ViewTransition 2.0"] + exportMetaObjectRevisions: [0] Property { name: "index"; type: "int"; isReadonly: true } Property { name: "item"; type: "QQuickItem"; isReadonly: true; isPointer: true } Property { name: "destination"; type: "QPointF"; isReadonly: true } @@ -3559,134 +3922,10 @@ Module { Property { name: "targetItems"; type: "QObject"; isList: true; isReadonly: true } } Component { - name: "QQuickVisualDataGroup" - prototype: "QObject" - exports: ["QtQuick/VisualDataGroup 2.0"] - Property { name: "count"; type: "int"; isReadonly: true } - Property { name: "name"; type: "string" } - Property { name: "includeByDefault"; type: "bool" } - Signal { name: "defaultIncludeChanged" } - Signal { - name: "changed" - Parameter { name: "removed"; type: "QQmlV8Handle" } - Parameter { name: "inserted"; type: "QQmlV8Handle" } - } - Method { - name: "insert" - Parameter { type: "QQmlV8Function"; isPointer: true } - } - Method { - name: "create" - Parameter { type: "QQmlV8Function"; isPointer: true } - } - Method { - name: "resolve" - Parameter { type: "QQmlV8Function"; isPointer: true } - } - Method { - name: "remove" - Parameter { type: "QQmlV8Function"; isPointer: true } - } - Method { - name: "addGroups" - Parameter { type: "QQmlV8Function"; isPointer: true } - } - Method { - name: "removeGroups" - Parameter { type: "QQmlV8Function"; isPointer: true } - } - Method { - name: "setGroups" - Parameter { type: "QQmlV8Function"; isPointer: true } - } - Method { - name: "move" - Parameter { type: "QQmlV8Function"; isPointer: true } - } - Method { - name: "get" - type: "QQmlV8Handle" - Parameter { name: "index"; type: "int" } - } - } - Component { - name: "QQuickVisualDataModel" - defaultProperty: "delegate" - prototype: "QQuickVisualModel" - exports: ["QtQuick/VisualDataModel 2.0"] - attachedType: "QQuickVisualDataModelAttached" - Property { name: "model"; type: "QVariant" } - Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } - Property { name: "filterOnGroup"; type: "string" } - Property { name: "items"; type: "QQuickVisualDataGroup"; isReadonly: true; isPointer: true } - Property { - name: "persistedItems" - type: "QQuickVisualDataGroup" - isReadonly: true - isPointer: true - } - Property { name: "groups"; type: "QQuickVisualDataGroup"; isList: true; isReadonly: true } - Property { name: "parts"; type: "QObject"; isReadonly: true; isPointer: true } - Property { name: "rootIndex"; type: "QVariant" } - Signal { name: "filterGroupChanged" } - Signal { name: "defaultGroupsChanged" } - Method { - name: "modelIndex" - type: "QVariant" - Parameter { name: "idx"; type: "int" } - } - Method { name: "parentModelIndex"; type: "QVariant" } - } - Component { - name: "QQuickVisualDataModelAttached" - prototype: "QObject" - Property { name: "model"; type: "QQuickVisualDataModel"; isReadonly: true; isPointer: true } - Property { name: "groups"; type: "QStringList" } - Property { name: "isUnresolved"; type: "bool"; isReadonly: true } - Signal { name: "unresolvedChanged" } - } - Component { name: "QQuickVisualDataModelParts"; prototype: "QObject" } - Component { - name: "QQuickVisualItemModel" - defaultProperty: "children" - prototype: "QQuickVisualModel" - exports: ["QtQuick/VisualItemModel 2.0"] - attachedType: "QQuickVisualItemModelAttached" - Property { name: "children"; type: "QQuickItem"; isList: true; isReadonly: true } - } - Component { - name: "QQuickVisualItemModelAttached" - prototype: "QObject" - Property { name: "index"; type: "int"; isReadonly: true } - } - Component { - name: "QQuickVisualModel" - prototype: "QObject" - Property { name: "count"; type: "int"; isReadonly: true } - Signal { - name: "modelUpdated" - Parameter { name: "changeSet"; type: "QQuickChangeSet" } - Parameter { name: "reset"; type: "bool" } - } - Signal { - name: "createdItem" - Parameter { name: "index"; type: "int" } - Parameter { name: "item"; type: "QQuickItem"; isPointer: true } - } - Signal { - name: "initItem" - Parameter { name: "index"; type: "int" } - Parameter { name: "item"; type: "QQuickItem"; isPointer: true } - } - Signal { - name: "destroyingItem" - Parameter { name: "item"; type: "QQuickItem"; isPointer: true } - } - } - Component { name: "QQuickWorkerScript" prototype: "QObject" exports: ["QtQuick/WorkerScript 2.0"] + exportMetaObjectRevisions: [0] Property { name: "source"; type: "QUrl" } Signal { name: "message" @@ -3701,6 +3940,7 @@ Module { name: "QRegExpValidator" prototype: "QValidator" exports: ["QtQuick/RegExpValidator 2.0"] + exportMetaObjectRevisions: [0] Property { name: "regExp"; type: "QRegExp" } Signal { name: "regExpChanged" @@ -3866,9 +4106,11 @@ Module { "SplashScreen": 15, "Desktop": 17, "SubWindow": 18, + "ForeignWindow": 33, "WindowType_Mask": 255, "MSWindowsFixedSizeDialogHint": 256, "MSWindowsOwnDC": 512, + "BypassWindowManagerHint": 1024, "X11BypassWindowManagerHint": 1024, "FramelessWindowHint": 2048, "WindowTitleHint": 4096, @@ -3907,9 +4149,11 @@ Module { "SplashScreen": 15, "Desktop": 17, "SubWindow": 18, + "ForeignWindow": 33, "WindowType_Mask": 255, "MSWindowsFixedSizeDialogHint": 256, "MSWindowsOwnDC": 512, + "BypassWindowManagerHint": 1024, "X11BypassWindowManagerHint": 1024, "FramelessWindowHint": 2048, "WindowTitleHint": 4096, @@ -4105,7 +4349,8 @@ Module { "AA_X11InitThreads": 10, "AA_SynthesizeTouchForUnhandledMouseEvents": 11, "AA_SynthesizeMouseForUnhandledTouchEvents": 12, - "AA_AttributeCount": 13 + "AA_UseHighDpiPixmaps": 13, + "AA_AttributeCount": 14 } } Enum { @@ -4790,6 +5035,15 @@ Module { } } Enum { + name: "Edge" + values: { + "TopEdge": 1, + "LeftEdge": 2, + "RightEdge": 4, + "BottomEdge": 8 + } + } + Enum { name: "ConnectionType" values: { "AutoConnection": 0, @@ -4916,6 +5170,7 @@ Module { "ImhDate": 128, "ImhTime": 256, "ImhPreferLatin": 512, + "ImhMultiLine": 1024, "ImhDigitsOnly": 65536, "ImhFormattedNumbersOnly": 131072, "ImhUppercaseOnly": 262144, @@ -4941,6 +5196,7 @@ Module { "ImhDate": 128, "ImhTime": 256, "ImhPreferLatin": 512, + "ImhMultiLine": 1024, "ImhDigitsOnly": 65536, "ImhFormattedNumbersOnly": 131072, "ImhUppercaseOnly": 262144, @@ -5010,7 +5266,8 @@ Module { "ItemIsDropEnabled": 8, "ItemIsUserCheckable": 16, "ItemIsEnabled": 32, - "ItemIsTristate": 64 + "ItemIsTristate": 64, + "ItemNeverHasChildren": 128 } } Enum { diff --git a/src/imports/testlib/TestCase.qml b/src/imports/testlib/TestCase.qml index 7584241ca6..0bec4cddf2 100644 --- a/src/imports/testlib/TestCase.qml +++ b/src/imports/testlib/TestCase.qml @@ -291,6 +291,11 @@ Item { } function tryCompare(obj, prop, value, timeout) { + if (arguments.length == 2) { + qtest_results.fail("A value is required for tryCompare", + util.callerFile(), util.callerLine()) + throw new Error("QtQuickTest::fail") + } if (!timeout) timeout = 5000 if (!qtest_compareInternal(obj[prop], value)) diff --git a/src/imports/widgets/plugins.qmltypes b/src/imports/widgets/plugins.qmltypes index 583a36a357..9e73330c12 100644 --- a/src/imports/widgets/plugins.qmltypes +++ b/src/imports/widgets/plugins.qmltypes @@ -39,6 +39,7 @@ Module { Property { name: "visible"; type: "bool" } Property { name: "modality"; type: "Qt::WindowModality" } Property { name: "title"; type: "string" } + Property { name: "isWindow"; type: "bool"; isReadonly: true } Property { name: "x"; type: "int" } Property { name: "y"; type: "int" } Property { name: "width"; type: "int" } @@ -56,7 +57,7 @@ Module { Property { name: "selectExisting"; type: "bool" } Property { name: "selectMultiple"; type: "bool" } Property { name: "selectFolder"; type: "bool" } - Property { name: "folder"; type: "string" } + Property { name: "folder"; type: "QUrl" } Property { name: "nameFilters"; type: "QStringList" } Property { name: "selectedNameFilter"; type: "string" } Property { name: "fileUrl"; type: "QUrl"; isReadonly: true } @@ -86,7 +87,7 @@ Module { } Method { name: "setFolder" - Parameter { name: "f"; type: "string" } + Parameter { name: "f"; type: "QUrl" } } Method { name: "setNameFilters" diff --git a/src/imports/widgets/qquickqcolordialog.cpp b/src/imports/widgets/qquickqcolordialog.cpp index abe6ffd004..d10eacee60 100644 --- a/src/imports/widgets/qquickqcolordialog.cpp +++ b/src/imports/widgets/qquickqcolordialog.cpp @@ -68,8 +68,11 @@ public: virtual void exec() { m_dialog.exec(); } virtual bool show(Qt::WindowFlags f, Qt::WindowModality m, QWindow *parent) { - m_dialog.windowHandle()->setTransientParent(parent); - m_dialog.windowHandle()->setFlags(f); + m_dialog.winId(); + QWindow *window = m_dialog.windowHandle(); + Q_ASSERT(window); + window->setTransientParent(parent); + window->setFlags(f); m_dialog.setWindowModality(m); m_dialog.setWindowTitle(QPlatformColorDialogHelper::options()->windowTitle()); m_dialog.setOptions((QColorDialog::ColorDialogOptions)((int)(QPlatformColorDialogHelper::options()->options()))); diff --git a/src/imports/widgets/qquickqfiledialog.cpp b/src/imports/widgets/qquickqfiledialog.cpp index 672c6d1bf4..498e34a24c 100644 --- a/src/imports/widgets/qquickqfiledialog.cpp +++ b/src/imports/widgets/qquickqfiledialog.cpp @@ -96,8 +96,11 @@ public: virtual void exec() { m_dialog.exec(); } virtual bool show(Qt::WindowFlags f, Qt::WindowModality m, QWindow *parent) { - m_dialog.windowHandle()->setTransientParent(parent); - m_dialog.windowHandle()->setFlags(f); + m_dialog.winId(); + QWindow *window = m_dialog.windowHandle(); + Q_ASSERT(window); + window->setTransientParent(parent); + window->setFlags(f); m_dialog.setWindowModality(m); m_dialog.show(); return m_dialog.isVisible(); @@ -132,14 +135,14 @@ private: \qmlsignal QtQuick::Dialogs::FileDialog::accepted The \a accepted signal is emitted when the user has finished using the - dialog. You can then inspect the \a filePath or \a filePaths properties to + dialog. You can then inspect the \a fileUrl or \a fileUrls properties to get the selection. Example: \qml FileDialog { - onAccepted: { console.log("Selected file: " + filePath) } + onAccepted: { console.log("Selected file: " + fileUrl) } } \endqml */ diff --git a/src/imports/window/plugins.qmltypes b/src/imports/window/plugins.qmltypes index b79702edb6..59e69114e1 100644 --- a/src/imports/window/plugins.qmltypes +++ b/src/imports/window/plugins.qmltypes @@ -3,7 +3,7 @@ import QtQuick.tooling 1.1 // This file describes the plugin-supplied types contained in the library. // It is used for QML tooling purposes only. // -// This file was auto-generated with the command '../../../bin/qmlplugindump.app/Contents/MacOS/qmlplugindump QtQuick.Window 2.1 -notrelocatable'. +// This file was auto-generated with the command 'qmlplugindump QtQuick.Window 2.1 -notrelocatable'. Module { Component { @@ -23,15 +23,23 @@ Module { name: "QQuickScreen" prototype: "QObject" exports: ["QtQuick.Window/Screen 2.0"] + exportMetaObjectRevisions: [0] attachedType: "QQuickScreenAttached" } Component { name: "QQuickScreenAttached" prototype: "QObject" + Property { name: "name"; revision: 1; type: "string"; isReadonly: true } Property { name: "width"; type: "int"; isReadonly: true } Property { name: "height"; type: "int"; isReadonly: true } + Property { name: "desktopAvailableWidth"; revision: 1; type: "int"; isReadonly: true } + Property { name: "desktopAvailableHeight"; revision: 1; type: "int"; isReadonly: true } + Property { name: "logicalPixelDensity"; revision: 1; type: "double"; isReadonly: true } Property { name: "primaryOrientation"; type: "Qt::ScreenOrientation"; isReadonly: true } Property { name: "orientation"; type: "Qt::ScreenOrientation"; isReadonly: true } + Signal { name: "nameChanged"; revision: 1 } + Signal { name: "desktopGeometryChanged"; revision: 1 } + Signal { name: "logicalPixelDensityChanged"; revision: 1 } Method { name: "angleBetween" type: "int" @@ -62,6 +70,11 @@ Module { Signal { name: "beforeRendering" } Signal { name: "afterRendering" } Signal { + name: "closing" + revision: 1 + Parameter { name: "close"; type: "QQuickCloseEvent"; isPointer: true } + } + Signal { name: "colorChanged" Parameter { type: "QColor" } } @@ -95,6 +108,7 @@ Module { Property { name: "maximumWidth"; revision: 1; type: "int" } Property { name: "maximumHeight"; revision: 1; type: "int" } Property { name: "visible"; type: "bool" } + Property { name: "active"; revision: 1; type: "bool"; isReadonly: true } Property { name: "visibility"; revision: 1; type: "Visibility" } Property { name: "contentOrientation"; revision: 1; type: "Qt::ScreenOrientation" } Property { name: "opacity"; revision: 1; type: "double" } @@ -155,6 +169,7 @@ Module { revision: 1 Parameter { name: "visibility"; type: "QWindow::Visibility" } } + Signal { name: "activeChanged"; revision: 1 } Signal { name: "contentOrientationChanged" revision: 1 @@ -169,6 +184,7 @@ Module { revision: 1 Parameter { name: "opacity"; type: "double" } } + Method { name: "requestActivate"; revision: 1 } Method { name: "setVisible" Parameter { name: "visible"; type: "bool" } @@ -222,5 +238,9 @@ Module { revision: 1 Parameter { name: "h"; type: "int" } } + Method { + name: "alert" + Parameter { name: "msec"; type: "int" } + } } } diff --git a/src/plugins/accessible/quick/qaccessiblequickview.cpp b/src/plugins/accessible/quick/qaccessiblequickview.cpp index b85f23c48b..1240b2ef4c 100644 --- a/src/plugins/accessible/quick/qaccessiblequickview.cpp +++ b/src/plugins/accessible/quick/qaccessiblequickview.cpp @@ -81,10 +81,8 @@ QAccessibleInterface *QAccessibleQuickWindow::parent() const QAccessibleInterface *QAccessibleQuickWindow::child(int index) const { - if (index == 0) { - if (QQuickItem *declarativeRoot = rootItem()) - return new QAccessibleQuickItem(declarativeRoot); - } + if (index == 0) + return QAccessible::queryAccessibleInterface(rootItem()); return 0; } diff --git a/src/qml/animations/qsequentialanimationgroupjob.cpp b/src/qml/animations/qsequentialanimationgroupjob.cpp index c649370680..b82e1850f7 100644 --- a/src/qml/animations/qsequentialanimationgroupjob.cpp +++ b/src/qml/animations/qsequentialanimationgroupjob.cpp @@ -226,14 +226,14 @@ void QSequentialAnimationGroupJob::updateCurrentTime(int currentTime) if (atEnd()) { //we make sure that we don't exceed the duration here m_currentTime += m_currentAnimation->currentTime() - newCurrentTime; - stop(); + RETURN_IF_DELETED(stop()); } } else { //the only case where currentAnimation could be null //is when all animations have been removed Q_ASSERT(!firstChild()); m_currentTime = 0; - stop(); + RETURN_IF_DELETED(stop()); } m_previousLoop = m_currentLoop; diff --git a/src/qml/debugger/qqmlprofilerservice.cpp b/src/qml/debugger/qqmlprofilerservice.cpp index 963a861821..0ba939cdca 100644 --- a/src/qml/debugger/qqmlprofilerservice.cpp +++ b/src/qml/debugger/qqmlprofilerservice.cpp @@ -105,7 +105,7 @@ QByteArray QQmlProfilerData::toByteArray() const case QQmlProfilerService::SceneGraphWindowsRenderShow: ds << subtime_1 << subtime_2 << subtime_3; break; // WindowsAnimations: update time case QQmlProfilerService::SceneGraphWindowsAnimations: ds << subtime_1; break; - // WindowsRenderWindow: polish time, sync time, render time, swap time + // WindowsRenderWindow: polish time case QQmlProfilerService::SceneGraphWindowsPolishFrame: ds << subtime_1; break; default:break; } diff --git a/src/qml/doc/qtqml.qdocconf b/src/qml/doc/qtqml.qdocconf index 84cf64eddd..2198428a38 100644 --- a/src/qml/doc/qtqml.qdocconf +++ b/src/qml/doc/qtqml.qdocconf @@ -18,7 +18,7 @@ qhp.QtQml.indexRoot = qhp.QtQml.filterAttributes = qtqml $QT_VERSION qtrefdoc qhp.QtQml.customFilters.Qt.name = QtQml $QT_VERSION qhp.QtQml.customFilters.Qt.filterAttributes = qtqml $QT_VERSION -qhp.QtQml.subprojects = classes examples +qhp.QtQml.subprojects = qmltypes classes examples qhp.QtQml.subprojects.classes.title = C++ Classes qhp.QtQml.subprojects.classes.indexTitle = Qt QML C++ Classes qhp.QtQml.subprojects.classes.selectors = class fake:headerfile @@ -26,15 +26,21 @@ qhp.QtQml.subprojects.classes.sortPages = true qhp.QtQml.subprojects.examples.title = Examples qhp.QtQml.subprojects.examples.indexTitle = Qt Quick Code Samples qhp.QtQml.subprojects.examples.selectors = fake:example +qhp.QtQml.subprojects.qmltypes.title = QML Types +qhp.QtQml.subprojects.qmltypes.indexTitle = Qt QML QML Types +qhp.QtQml.subprojects.qmltypes.selectors = fake:qmlclass +qhp.QtQml.subprojects.qmltypes.sortPages = true tagfile = ../../../doc/qtqml/qtqml.tags depends += qtcore qtxmlpatterns qtgui qtquick qtdoc -headerdirs += .. +headerdirs += .. \ + ../../imports/models -sourcedirs += .. +sourcedirs += .. \ + ../../imports/models exampledirs += ../../../examples/qml \ ../ \ diff --git a/src/qml/doc/src/javascript/hostenvironment.qdoc b/src/qml/doc/src/javascript/hostenvironment.qdoc index a63ef617c0..3bd64ac115 100644 --- a/src/qml/doc/src/javascript/hostenvironment.qdoc +++ b/src/qml/doc/src/javascript/hostenvironment.qdoc @@ -166,6 +166,15 @@ Item { } \endqml +\li The \c with statement is deprecated. Using the \c with statement will issue a warning +at loading time and we plan on removing support for it in Qt 5.2. It is generally considered +a language feature that is not recommended for use due reducing the readability of code and disabling +many optimizations in the engine. It is also forbidden in ECMAScript 5 strict mode. + +\li JavaScript binding expressions are executed in non-strict mode. However we +plan on changing the default for bindings in Qt 5.2 to execute always in +ECMAScript 5 strict mode. + \endlist diff --git a/src/qml/doc/src/qmltypereference.qdoc b/src/qml/doc/src/qmltypereference.qdoc index f0aadbaf32..3def3209cc 100644 --- a/src/qml/doc/src/qmltypereference.qdoc +++ b/src/qml/doc/src/qmltypereference.qdoc @@ -58,8 +58,13 @@ follows: import QtQuick 2.0 \endqml -See the \l{Qt Quick} module documentation for more information about the -\c QtQuick namespace and what it provides to QML application developers. +See the \l{Qt Quick} module documentation for more information about the \c +QtQuick namespace and what it provides to QML application developers. + +The QML types for creating lists and models, such as \l ListModel and \l +ListElement, are moved to a submodule, \c QtQml.Models. The \l{Qt QML Models QML +Types}{Qt QML Models} page has more information. + The documentation for the types below applies equally to the types of the same name provided by the \l{Qt Quick} module, as they are in fact identical. diff --git a/src/qml/doc/src/qtqml.qdoc b/src/qml/doc/src/qtqml.qdoc index 2c6bc640ff..26e4867bbc 100644 --- a/src/qml/doc/src/qtqml.qdoc +++ b/src/qml/doc/src/qtqml.qdoc @@ -84,6 +84,19 @@ various QML object types: \li \l Timer \endlist +\section2 Lists and Models + +New in Qt 5.1, the model types are moved to a submodule, \c QtQml.Models. The +\l{Qt QML Models QML Types}{Qt QML Models} page has more information. + +\list +\li \l DelegateModel +\li \l DelegateModelGroup +\li \l ListElement +\li \l ListModel +\li \l ObjectModel +\endlist + \section1 JavaScript Environment for QML Applications JavaScript expressions allow QML code to contain application logic. Qt QML diff --git a/src/qml/doc/src/whatsnew.qdoc b/src/qml/doc/src/whatsnew.qdoc index 6ca979db37..9ad8c23a42 100644 --- a/src/qml/doc/src/whatsnew.qdoc +++ b/src/qml/doc/src/whatsnew.qdoc @@ -29,7 +29,34 @@ \title Qt QML Release Notes \page qtqml-releasenotes.html -\section1 Qt QML in Qt 5 +\section1 Qt QML in Qt 5.1 + +Qt 5.1 introduces several bug fixes and new functionalities to Qt QML. This is +a summary of the new changes: +\list +\li New QQmlApplicationEngine convenience class for QML applications. +\li New Instantiatior type for generic, dynamic object creation. +\li New properties for \l Qt.application: arguments, name, and version. +\li The 'with' statement has been deprecated and is slated for removal in a + future version of the language. +\li New \l Qt.platform object with an os property +\li New \l qmlClearTypeRegistations() function drops all data from qmlRegisterType calls +\li New \l qmlRegisterType function for registering composite types. +\endlist + +\section2 New Submodule + +The \l{Qt QML Models QML Types}{Qt QML Models} is a new submodule in Qt 5.1 and +provides several QML types for handling data with models and lists. These types +replace types such as \l VisualItem, \l VisualDataModel, and \l VisualDataGroup. + +\list +\li \l{Qt QML Models QML Types}{Models} +\endlist + +The \l{What's New in Qt 5.1} has more information about the Qt 5.1 release. + +\section1 Qt QML in Qt 5.0 The \l{Qt QML} module is new in Qt 5.0. It provides the QML engine and implements the QML language supporting infrastructure. @@ -88,6 +115,8 @@ has now been replaced by the new \l {Qt QML} and \l {Qt Quick} modules. See the \list \li Arbitrary functionality may be provided in a namespace through a singleton type. See qmlRegisterSingletonType() for more information. \li JavaScript (.js) files may now import QML modules and other JavaScript files using the ".import" syntax. +\li Plugins may now use QQmlExtensionPlugin::baseUrl to get the directory from which the plugin is loaded. + This will be useful if the plugin needs to load QML or other assets from the same directory. \endlist \section2 Other diff --git a/src/qml/qml/parser/qqmljs.g b/src/qml/qml/parser/qqmljs.g index ff4f54374b..5d279ef1a2 100644 --- a/src/qml/qml/parser/qqmljs.g +++ b/src/qml/qml/parser/qqmljs.g @@ -2615,6 +2615,10 @@ case $rule_number: { node->lparenToken = loc(2); node->rparenToken = loc(4); sym(1).Node = node; + if (lexer->qmlMode()) { + const QString msg = qApp->translate("QQmlParser", "Deprecated JavaScript `with' statement detected in QML expression. Support for this will be removed in Qt 5.2!"); + diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, node->withToken, msg)); + } } break; ./ diff --git a/src/qml/qml/parser/qqmljsparser.cpp b/src/qml/qml/parser/qqmljsparser.cpp index a0fa7a4711..46b5c041d4 100644 --- a/src/qml/qml/parser/qqmljsparser.cpp +++ b/src/qml/qml/parser/qqmljsparser.cpp @@ -1515,6 +1515,10 @@ case 311: { node->lparenToken = loc(2); node->rparenToken = loc(4); sym(1).Node = node; + if (lexer->qmlMode()) { + const QString msg = qApp->translate("QQmlParser", "Deprecated JavaScript `with' statement detected in QML expression. Support for this will be removed in Qt 5.2!"); + diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, node->withToken, msg)); + } } break; case 312: { diff --git a/src/qml/qml/qqml.h b/src/qml/qml/qqml.h index fb0133f305..b48a776b4f 100644 --- a/src/qml/qml/qqml.h +++ b/src/qml/qml/qqml.h @@ -49,7 +49,6 @@ #include <QtCore/qbytearray.h> #include <QtCore/qmetaobject.h> -#include <QtCore/qdebug.h> #define QML_VERSION 0x020000 #define QML_VERSION_STR "2.0" @@ -477,7 +476,7 @@ inline int qmlRegisterType(const QUrl &url, const char *uri, int versionMajor, i { if (url.isRelative()) { // User input check must go here, because QQmlPrivate::qmlregister is also used internally for composite types - qWarning() << "qmlRegisterType requires absolute URLs."; + qWarning("qmlRegisterType requires absolute URLs."); return 0; } diff --git a/src/qml/qml/qqmlapplicationengine.cpp b/src/qml/qml/qqmlapplicationengine.cpp index 25095a465e..9181dad519 100644 --- a/src/qml/qml/qqmlapplicationengine.cpp +++ b/src/qml/qml/qqmlapplicationengine.cpp @@ -72,6 +72,7 @@ void QQmlApplicationEnginePrivate::init() QCoreApplication::installTranslator(qtTranslator); translators << qtTranslator; #endif + QCoreApplication::instance()->setProperty("__qml_using_qqmlapplicationengine", QVariant(true)); } void QQmlApplicationEnginePrivate::loadTranslations(const QUrl &rootFile) @@ -166,9 +167,14 @@ void QQmlApplicationEnginePrivate::_q_finishLoad(QObject *o) \list \li Connecting Qt.quit() to QCoreApplication::quit() \li Automatically loads translation files from an i18n directory adjacent to the main QML file. + \li Automatically sets an incubuation controller if the scene contains a QQuickWindow. \endlist The engine behavior can be further tweaked by using the inherited methods from QQmlEngine. + + \note In the future QQmlApplicationEngine may automatically apply file selectors. + To ensure forwards compatibility, do not use folder names containing a '+' character in your QML file + structure. */ /*! diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index 64662138e1..9998af3890 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -391,9 +391,9 @@ The following functions are also on the Qt object. \list \li \c "android" - Android \li \c "blackberry" - BlackBerry OS - \li \c "ios" - Apple iOS + \li \c "ios" - iOS \li \c "linux" - Linux - \li \c "mac" - Mac OS X + \li \c "osx" - OS X \li \c "unix" - Other Unix-based OS \li \c "windows" - Windows \li \c "wince" - Windows CE diff --git a/src/qml/qml/qqmlextensionplugin.cpp b/src/qml/qml/qqmlextensionplugin.cpp index f77b176404..30eca7b112 100644 --- a/src/qml/qml/qqmlextensionplugin.cpp +++ b/src/qml/qml/qqmlextensionplugin.cpp @@ -45,7 +45,7 @@ QT_BEGIN_NAMESPACE /*! - \since 5.0 + \since Qt 5.0 \inmodule QtQml \class QQmlExtensionPlugin \brief The QQmlExtensionPlugin class provides an abstract base for custom QML extension plugins. @@ -156,6 +156,13 @@ QQmlExtensionPlugin::~QQmlExtensionPlugin() { } +/*! + \since Qt 5.1 + \brief Returns the URL of the directory from which the extension is loaded. + + This is useful when the plugin also needs to load QML files or other + assets from the same directory. +*/ QUrl QQmlExtensionPlugin::baseUrl() const { Q_D(const QQmlExtensionPlugin); diff --git a/src/qml/qml/qqmlextensionplugin.h b/src/qml/qml/qqmlextensionplugin.h index 170c7915a5..245651979b 100644 --- a/src/qml/qml/qqmlextensionplugin.h +++ b/src/qml/qml/qqmlextensionplugin.h @@ -68,6 +68,7 @@ public: virtual void registerTypes(const char *uri) = 0; virtual void initializeEngine(QQmlEngine *engine, const char *uri); +private: Q_DISABLE_COPY(QQmlExtensionPlugin) }; diff --git a/src/qml/qml/qqmlplatform.cpp b/src/qml/qml/qqmlplatform.cpp index de48f60f56..04862379be 100644 --- a/src/qml/qml/qqmlplatform.cpp +++ b/src/qml/qml/qqmlplatform.cpp @@ -66,7 +66,7 @@ QString QQmlPlatform::os() #elif defined(Q_OS_IOS) return QLatin1String("ios"); #elif defined(Q_OS_MAC) - return QLatin1String("mac"); + return QLatin1String("osx"); #elif defined(Q_OS_WINCE) return QLatin1String("wince"); #elif defined(Q_OS_WIN) diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp index b1ffc9a2d5..4712fbd614 100644 --- a/src/qml/qml/qqmlpropertycache.cpp +++ b/src/qml/qml/qqmlpropertycache.cpp @@ -1317,25 +1317,10 @@ QQmlPropertyData qQmlPropertyCacheCreate(const QMetaObject *metaObject, const QS Q_ASSERT(metaObject); QQmlPropertyData rv; - { - const QMetaObject *cmo = metaObject; - const QByteArray propertyName = property.toUtf8(); - while (cmo) { - int idx = cmo->indexOfProperty(propertyName); - if (idx != -1) { - QMetaProperty p = cmo->property(idx); - if (p.isScriptable()) { - rv.load(p); - return rv; - } else { - while (cmo && cmo->propertyOffset() >= idx) - cmo = cmo->superClass(); - } - } else { - cmo = 0; - } - } - } + + /* It's important to check the method list before checking for properties; + * otherwise, if the meta object is dynamic, a property will be created even + * if not found and it might obscure a method having the same name. */ //Used to block access to QObject::destroyed() and QObject::deleteLater() from QML static const int destroyedIdx1 = QObject::staticMetaObject.indexOfSignal("destroyed(QObject*)"); @@ -1357,6 +1342,31 @@ QQmlPropertyData qQmlPropertyCacheCreate(const QMetaObject *metaObject, const QS } } + { + const QMetaObject *cmo = metaObject; + const QByteArray propertyName = property.toUtf8(); + while (cmo) { + int idx = cmo->indexOfProperty(propertyName); + if (idx != -1) { + QMetaProperty p = cmo->property(idx); + if (p.isScriptable()) { + rv.load(p); + return rv; + } else { + bool changed = false; + while (cmo && cmo->propertyOffset() >= idx) { + cmo = cmo->superClass(); + changed = true; + } + /* If the "cmo" variable didn't change, set it to 0 to + * avoid running into an infinite loop */ + if (!changed) cmo = 0; + } + } else { + cmo = 0; + } + } + } return rv; } @@ -1395,7 +1405,8 @@ qQmlPropertyCacheProperty(QQmlEngine *engine, QObject *obj, const T &name, if (cache) { rv = cache->property(name, obj, context); - } else { + } + if (!rv) { local = qQmlPropertyCacheCreate(obj->metaObject(), qQmlPropertyCacheToString(name)); if (local.isValid()) rv = &local; diff --git a/src/qml/qml/qqmlscript.cpp b/src/qml/qml/qqmlscript.cpp index 613ff24f20..ba2882f3e7 100644 --- a/src/qml/qml/qqmlscript.cpp +++ b/src/qml/qml/qqmlscript.cpp @@ -1318,13 +1318,15 @@ bool QQmlScript::Parser::parse(const QString &qmlcode, const QByteArray & /* pre QQmlJS::Parser parser(&data->engine); - if (! parser.parse() || !_errors.isEmpty()) { + if (! parser.parse() || !parser.diagnosticMessages().isEmpty()) { // Extract errors from the parser foreach (const DiagnosticMessage &m, parser.diagnosticMessages()) { - if (m.isWarning()) + if (m.isWarning()) { + qWarning("%s:%d : %s", qPrintable(_scriptFile), m.loc.startLine, qPrintable(m.message)); continue; + } QQmlError error; error.setUrl(url); diff --git a/src/qml/qml/v8/qv8qobjectwrapper.cpp b/src/qml/qml/v8/qv8qobjectwrapper.cpp index 0336457027..53f70ad132 100644 --- a/src/qml/qml/v8/qv8qobjectwrapper.cpp +++ b/src/qml/qml/v8/qv8qobjectwrapper.cpp @@ -524,7 +524,7 @@ v8::Handle<v8::Value> QV8QObjectWrapper::GetProperty(QV8Engine *engine, QObject QQmlData *ddata = QQmlData::get(object, false); if (ddata && ddata->propertyCache) result = ddata->propertyCache->property(property, object, context); - else + if (!result) result = QQmlPropertyCache::property(engine->engine(), object, property, context, local); } diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp index 53b8a3c79d..747c9391e9 100644 --- a/src/qml/types/qqmldelegatemodel.cpp +++ b/src/qml/types/qqmldelegatemodel.cpp @@ -121,15 +121,16 @@ QQmlDelegateModelParts::QQmlDelegateModelParts(QQmlDelegateModel *parent) /*! \qmltype VisualDataModel \instantiates QQmlDelegateModel - \inqmlmodule QtQml 2 + \inqmlmodule QtQuick 2 \ingroup qtquick-models \brief Encapsulates a model and delegate The VisualDataModel type encapsulates a model and the delegate that will be instantiated for items in a model. - This type is provided by \c {QtQuick 2} for compatibility reasons. The same implementation - is now primarily available as DelegateModel in the QtQml.Models module. + This type is provided by the \l{Qt QML} module due to compatibility reasons. + The same implementation is now primarily available as DelegateModel in the + \l{Qt QML Models QML Types}{Qt QML Models} module. \sa {QtQml.Models2::DelegateModel} */ @@ -142,12 +143,6 @@ QQmlDelegateModelParts::QQmlDelegateModelParts(QQmlDelegateModel *parent) The DelegateModel type encapsulates a model and the delegate that will be instantiated for items in the model. - This element is also available as DelegateModel in the \c QtQuick module. For full details, - see the \l DelegateModel documentation. - - The DelegateModel type encapsulates a model and the delegate that will - be instantiated for items in the model. - It is usually not necessary to create a DelegateModel. However, it can be useful for manipulating and accessing the \l modelIndex when a QAbstractItemModel subclass is used as the @@ -158,6 +153,9 @@ QQmlDelegateModelParts::QQmlDelegateModelParts(QQmlDelegateModel *parent) The example below illustrates using a DelegateModel with a ListView. \snippet delegatemodel/visualdatamodel.qml 0 + + \note This type is also available as \l VisualDataModel in the \l{Qt QML} + module due to compatibility reasons. */ QQmlDelegateModelPrivate::QQmlDelegateModelPrivate(QQmlContext *ctxt) @@ -856,7 +854,8 @@ void QQmlDelegateModelPrivate::incubatorStatusChanged(QQDMIncubationTask *incuba delete cacheItem->object; cacheItem->object = 0; cacheItem->scriptRef -= 1; - cacheItem->contextData->destroy(); + if (cacheItem->contextData) + cacheItem->contextData->destroy(); cacheItem->contextData = 0; if (!cacheItem->isReferenced()) { @@ -2169,14 +2168,31 @@ void QQmlDelegateModelGroupPrivate::destroyingPackage(QQuickPackage *package) } /*! + \qmltype VisualDataGroup + \instantiates QQmlDelegateModelGroup + \inqmlmodule QtQuick 2 + \ingroup qtquick-models + \brief Encapsulates a filtered set of visual data items + + The VisualDataGroup type provides a means to address the model data of a + model's delegate items, as well as sort and filter these delegate items. + + This type is provided by the \l{Qt QML} module due to compatibility reasons. + The same implementation is now primarily available as \l DelegateModelGroup + in the \l{Qt QML Models QML Types}{Qt QML Models} module. + + \sa {QtQml.Models2::DelegateModelGroup} +*/ +/*! \qmltype DelegateModelGroup \instantiates QQmlDelegateModelGroup - \inqmlmodule QtQml 2 + \inqmlmodule QtQml.Models 2 \ingroup qtquick-models \brief Encapsulates a filtered set of visual data items - The DelegateModelGroup type provides a means to address the model data of a DelegateModel's - delegate items, as well as sort and filter these delegate items. + The DelegateModelGroup type provides a means to address the model data of a + DelegateModel's delegate items, as well as sort and filter these delegate + items. The initial set of instantiable delegate items in a DelegateModel is represented by its \l {QtQml.Models2::DelegateModel::items}{items} group, which normally directly reflects @@ -2200,24 +2216,11 @@ void QQmlDelegateModelGroupPrivate::destroyingPackage(QQuickPackage *package) type or to cherry-pick specific items that should be instantiated irregardless of whether they're currently within a view's visible area. - \sa {QML Dynamic View Ordering Tutorial} -*/ -/*! - \qmltype DelegateModelGroup - \instantiates QQmlDelegateModelGroup - \inqmlmodule QtQml.Models 2 - \brief Encapsulates a filtered set of visual data items - - The DelegateModelGroup type provides a means to address the model data of a DelegateModel's - delegate items, as well as sort and filter these delegate items. - - This element is also available as DelegateModelGroup in the \c QtQuick module. For full details, - see the \l DelegateModelGroup documentation. + \note This type is also available as \l VisualDataGroup in the \l{Qt QML} + module due to compatibility reasons. - \sa {QtQuick::DelegateModelGroup} + \sa {QML Dynamic View Ordering Tutorial} */ - - QQmlDelegateModelGroup::QQmlDelegateModelGroup(QObject *parent) : QObject(*new QQmlDelegateModelGroupPrivate, parent) { diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp index 9277b6ea8f..0cfd9c6ccb 100644 --- a/src/qml/types/qqmllistmodel.cpp +++ b/src/qml/types/qqmllistmodel.cpp @@ -1426,22 +1426,12 @@ QQmlListModelParser::ListInstruction *QQmlListModelParser::ListModelData::instru \qmltype ListModel \instantiates QQmlListModel \inqmlmodule QtQml.Models 2 - \brief Defines a free-form list data source - - The ListModel is a simple container of ListElement definitions, each containing data roles. - The contents can be defined dynamically, or explicitly in QML. - - This type is also available in the \c {QtQuick 2} import. For full documentation, see \l QtQuick2::ListModel -*/ -/*! - \qmltype ListModel - \instantiates QQmlListModel - \inqmlmodule QtQml 2 - \brief Defines a free-form list data source \ingroup qtquick-models + \brief Defines a free-form list data source - The ListModel is a simple container of ListElement definitions, each containing data roles. - The contents can be defined dynamically, or explicitly in QML. + The ListModel is a simple container of ListElement definitions, each + containing data roles. The contents can be defined dynamically, or + explicitly in QML. The number of elements in the model can be obtained from its \l count property. A number of familiar methods are also provided to manipulate the contents of the @@ -1801,7 +1791,7 @@ QHash<int, QByteArray> QQmlListModel::roleNames() const } /*! - \qmlproperty bool QtQml2::ListModel::dynamicRoles + \qmlproperty bool ListModel::dynamicRoles By default, the type of a role is fixed the first time the role is used. For example, if you create a role called @@ -1847,7 +1837,7 @@ void QQmlListModel::setDynamicRoles(bool enableDynamicRoles) } /*! - \qmlproperty int QtQml2::ListModel::count + \qmlproperty int ListModel::count The number of data entries in the model. */ int QQmlListModel::count() const @@ -2537,16 +2527,6 @@ bool QQmlListModelParser::definesEmptyList(const QString &s) \instantiates QQmlListElement \inqmlmodule QtQml.Models 2 \brief Defines a data item in a ListModel - - List elements are defined inside ListModel definitions, and represent items in a list. - - This type is also available in the \c {QtQuick 2} import. For full documentation, see \l QtQuick2::ListElement -*/ -/*! - \qmltype ListElement - \instantiates QQmlListElement - \inqmlmodule QtQml 2 - \brief Defines a data item in a ListModel \ingroup qtquick-models List elements are defined inside ListModel definitions, and represent items in a diff --git a/src/qml/types/qqmllistmodel_p_p.h b/src/qml/types/qqmllistmodel_p_p.h index 0190081320..44c349fbe6 100644 --- a/src/qml/types/qqmllistmodel_p_p.h +++ b/src/qml/types/qqmllistmodel_p_p.h @@ -229,6 +229,9 @@ private: QStringHash<Role *> roleHash; }; +/*! +\internal +*/ class ListElement { public: @@ -292,6 +295,9 @@ private: friend class ListModel; }; +/*! +\internal +*/ class ListModel { public: @@ -375,4 +381,3 @@ QT_END_NAMESPACE Q_DECLARE_METATYPE(ListModel *); #endif // QQUICKLISTMODEL_P_P_H - diff --git a/src/qml/types/qqmlobjectmodel.cpp b/src/qml/types/qqmlobjectmodel.cpp index 3e8a67a7d2..f2a7477c1b 100644 --- a/src/qml/types/qqmlobjectmodel.cpp +++ b/src/qml/types/qqmlobjectmodel.cpp @@ -169,7 +169,7 @@ public: /*! \qmltype VisualItemModel \instantiates QQmlObjectModel - \inqmlmodule QtQml 2 + \inqmlmodule QtQuick 2 \brief Defines a set of objects to be used as a model The VisualItemModel type encapsulates contains the objects to be used diff --git a/src/qmldevtools/qmldevtools.pro b/src/qmldevtools/qmldevtools.pro index a65ef94da9..10e1ce0275 100644 --- a/src/qmldevtools/qmldevtools.pro +++ b/src/qmldevtools/qmldevtools.pro @@ -3,9 +3,10 @@ TARGET = QtQmlDevTools QT = core CONFIG += static no_module_headers internal_module -MODULE_PRIVATE_INCLUDES = \ +MODULE_INCLUDES = \ \$\$QT_MODULE_INCLUDE_BASE \ - \$\$QT_MODULE_INCLUDE_BASE/QtQml \ + \$\$QT_MODULE_INCLUDE_BASE/QtQml +MODULE_PRIVATE_INCLUDES = \ \$\$QT_MODULE_INCLUDE_BASE/QtQml/$$QT.qml.VERSION \ \$\$QT_MODULE_INCLUDE_BASE/QtQml/$$QT.qml.VERSION/QtQml diff --git a/src/quick/designer/designerwindowmanager_p.h b/src/quick/designer/designerwindowmanager_p.h index 02aacf06bd..3bbd0c2825 100644 --- a/src/quick/designer/designerwindowmanager_p.h +++ b/src/quick/designer/designerwindowmanager_p.h @@ -67,7 +67,7 @@ class QSGContext; class QAnimationDriver; class QOpenGLContext; -class DesignerWindowManager : public QObject, public QSGRenderLoop +class DesignerWindowManager : public QSGRenderLoop { Q_OBJECT public: diff --git a/src/quick/doc/qtquick.qdocconf b/src/quick/doc/qtquick.qdocconf index fba4ff89df..30861d9b2e 100644 --- a/src/quick/doc/qtquick.qdocconf +++ b/src/quick/doc/qtquick.qdocconf @@ -34,7 +34,7 @@ qhp.QtQuick.subprojects.examples.selectors = fake:example tagfile = ../../../doc/qtquick/qtquick.tags -depends += qtcore qtxmlpatterns qtqml qtgui qtlinguist qtquickcontrols qtdoc +depends += qtcore qtxmlpatterns qtqml qtgui qtlinguist qtquickcontrols qtquicklayouts qtdoc qtquickdialogs headerdirs += .. @@ -58,3 +58,8 @@ sourcedirs += ../../imports #add plugins directory because of dependencies headerdirs += ../../plugins sourcedirs += ../../plugins + +#exclude certain directories +excludedirs += ../../imports/dialogs \ + ../../imports/models \ + ../../../examples/quick/dialogs diff --git a/src/quick/doc/src/concepts/positioning/layouts.qdoc b/src/quick/doc/src/concepts/positioning/layouts.qdoc index 785bcc6ca6..35be2f6235 100644 --- a/src/quick/doc/src/concepts/positioning/layouts.qdoc +++ b/src/quick/doc/src/concepts/positioning/layouts.qdoc @@ -28,9 +28,9 @@ /*! \ingroup qtquick-positioners \page qtquick-positioning-layouts.html -\title Item Layouts +\title Item Positioners -Positioner items are container items that manage the positions and sizes of +Positioner items are container items that manage the positions of items in a declarative user interface. Positioners behave in a similar way to the \l{Widgets and Layouts}{layout managers} used with standard Qt widgets, except that they are also containers in their own right. @@ -38,6 +38,10 @@ except that they are also containers in their own right. Positioners make it easier to work with many items when they need to be arranged in a regular layout. +\l{Qt Quick Layouts} can also be used to arrange Qt Quick items in a user interface. +They manage both the positions and the sizes of items on a declarative user interface, +and are well suited for resizable user interfaces. + \section1 Positioners A set of standard positioners are provided in the basic set of Qt Quick diff --git a/src/quick/doc/src/concepts/positioning/topic.qdoc b/src/quick/doc/src/concepts/positioning/topic.qdoc index 25fc6eaab7..bae6a7f71b 100644 --- a/src/quick/doc/src/concepts/positioning/topic.qdoc +++ b/src/quick/doc/src/concepts/positioning/topic.qdoc @@ -34,7 +34,7 @@ Visual items in QML can be positioned in a variety of ways. The most important positioning-related concept is that of anchoring, a form of relative positioning where items can be anchored (or attached) to each other at certain boundaries. Other positioning concepts include absolute positioning, -positioning with coordinate bindings, and layouts. +positioning with coordinate bindings, positioners, and layouts. \section1 Manual Positioning @@ -134,21 +134,20 @@ positioning, whereas a "contaminated" anchor layout is one which uses both anchoring and bindings (either on position-related [x,y] properties or on dimension-related [width,height] properties) to determine the position. -\section1 Layouts - -Qt Quick also provides some built-in layout items. For many use cases, the -best layout to use is a simple grid, row, or column, and Qt Quick provides -items which will layout children in these formations in the most efficient -manner possible. +\section1 Positioners -There are many well-known layouts which work well in user-interfaces, such as -grids and lists, rows and columns. Qt Quick supports these sort of pre-defined -layouts, which can often be more performant to draw than anchor or -binding-based layouts. See the documentation on -\l{qtquick-positioning-layouts.html}{layout types} for more -information about utilizing pre-defined layouts. +Qt Quick also provides some built-in positioner items. For many use cases, the best +positioner to use is a simple grid, row, or column, and Qt Quick provides items which +will position children in these formations in the most efficient manner possible. +See the documentation on \l{qtquick-positioning-layouts.html}{item positioners types} +for more information about utilizing pre-defined positioners. +\section1 Layouts +From Qt 5.1, the module \l {Qt Quick Layouts} can also be used to arrange Qt Quick +items in a user interface. Unlike positioners, the types in Qt Quick Layouts manage +both the positions and sizes of items in a declarative interface. They are well +suited for resizable user interfaces. \section1 Right-To-Left Support diff --git a/src/quick/doc/src/qmltypereference.qdoc b/src/quick/doc/src/qmltypereference.qdoc index 7e49ac0f51..6863758455 100644 --- a/src/quick/doc/src/qmltypereference.qdoc +++ b/src/quick/doc/src/qmltypereference.qdoc @@ -56,14 +56,20 @@ information about the concepts which are central to \c QtQuick. Qt Quick includes several submodules which contain additional types. \list - \li \l{QtQuick.XmlListModel 2}{XML List Model} - contains types + \li \l{Qt Quick XmlListModel QML Types}{XML List Model} - contains types for creating models from XML data - \li \l{QtQuick.LocalStorage 2}{Local Storage} - a submodule + \li \l{Qt Quick Local Storage QML Types}{Local Storage} - a submodule containing a JavaScript interface for an SQLite database - \li \l{QtQuick.Particles 2}{Particles} - provides a particle + \li \l{Qt Quick Particles QML Types}{Particles} - provides a particle system for QML applications - \li \l{QtQuick.Window 2}{Window} - contains types for creating + \li \l{Qt Quick Window QML Types}{Window} - contains types for creating top-level windows and accessing screen information + \li \l{Qt Quick Dialogs QML Types}{Dialogs} - contains types for creating and + interacting with system dialogs + \li \l{Qt Quick Controls QML Types}{Controls} - provides a set of reusable + UI components + \li \l{Qt Quick Layouts QML Types}{Layouts} - contains types that are used + to arrange items in the user interface \endlist \section1 Basic Types @@ -228,13 +234,26 @@ Animation paths \section2 Model/View Types And Data Storage And Access -Models And Model Data +QML Lists and Models + +The \l{Qt QML Models QML Types}{Qt QML Models} submodule provides the types for +structuring data with models and lists. +\list +\li \l ListModel - Defines a list of data +\li \l ListElement - Defines a data item in a \l ListModel +\endlist + +These QML types are part of Qt Quick for backwards compatibility, but for +newer applications, \l{Qt QML Models QML Types}{Qt QML Models} provides +the same functionality. \list -\li \l {QtQuick2::ListModel}{ListModel} - Defines a list of data -\li \l {QtQuick2::ListElement}{ListElement} - Defines a data item in a \l {QtQuick2::ListModel}{ListModel} \li \l {VisualItemModel} - Contains items that already defines its own visual delegate \li \l {VisualDataModel} - Encapsulates a model and a delegate -\li \l {VisualDataGroup} -Encapsulates a filtered set of visual data items +\li \l {VisualDataGroup} - Encapsulates a filtered set of visual data items +\endlist + +XML Lists +\list \li \l {XmlListModel} - Specifies a model using XPath expressions \li \l {XmlRole} - Specifies a role for an \l {XmlListModel} \endlist diff --git a/src/quick/doc/src/qtquick.qdoc b/src/quick/doc/src/qtquick.qdoc index cafe10db45..deb6aa164c 100644 --- a/src/quick/doc/src/qtquick.qdoc +++ b/src/quick/doc/src/qtquick.qdoc @@ -43,7 +43,7 @@ QML types for creating user interfaces with the QML language, and a \l{Qt Quick C++ Classes}{C++ API} for extending QML applications with C++ code. \note From Qt 5.1, a set of Qt Quick based UI controls is available to -create classic desktop-style user interfaces. Please see \l{Qt Quick Controls} +create user interfaces. Please see \l{Qt Quick Controls} for more information. For those new to QML and Qt Quick, please see @@ -125,6 +125,8 @@ Additional Qt Quick information: system for Qt Quick \li \l{QtQuick.Window 2}{Window} - contains types for creating top-level windows and accessing screen information + \li \l{Qt Quick Dialogs}{Dialogs} - contains types for creating and + interacting with system dialogs \endlist \li \l{Qt Quick Release Notes} - list of changes and additions in the Qt Quick \li \l{Qt Quick Code Samples} - list of all Qt Quick examples diff --git a/src/quick/doc/src/whatsnew.qdoc b/src/quick/doc/src/whatsnew.qdoc index baa0312aa4..26d88699bc 100644 --- a/src/quick/doc/src/whatsnew.qdoc +++ b/src/quick/doc/src/whatsnew.qdoc @@ -29,7 +29,45 @@ \title Qt Quick Release Notes \page qtquick-releasenotes.html -\section1 Qt Quick in Qt 5 +\section1 Qt Quick in Qt 5.1 + +\l{Qt Quick} 2.1 is new in Qt 5.1. This is a summary of improvements and new +features introduced by the new import and new classes in Qt 5.1: +\list +\li New threaded render loop for Mac, Linux, and Embedded. +\li New render loop for windows for smoother animations. +\li New \l Window properties: activeFocusItem, minimumWidth, minimumHeight, + maximumWidth, maximumHeight, visibility, contentOrientation, and opacity. +\li New \l Screen attached properties: name, desktopAvailableWidth, + desktopAvailableHeight, logicalPixelDensity +\li New \l Grid properties: horizontalAlignment, verticalAlignment, and + effectiveHorizontalAlignment. +\li New \l TextEdit properties: selectByKeyboard and textDocument +\li A \l Window declared inside another Window or \l Item will automatically be + transient for (centered upon) the outer window. +\li These types are now part of \l{Qt QML}: + \list + \li \l {VisualItemModel} + \li \l {VisualDataModel} - Encapsulates a model and a delegate + \li \l {VisualDataGroup} + \endlist + These types are kept due to compatibility reasons and are replaced by the + \l{Qt QML Models QML Types}{Qt QML Models} types. + \endlist +\endlist + +\section2 New Submodules + +In Qt 5.1, there are several new modules which extend Qt Quick functionalities. +\list +\li \l{Qt Quick Dialogs} - contains types for creating and interacting with system dialogs +\li \l{Qt Quick Controls} - provides a set of reusable UI components +\li \l{Qt Quick Layouts} - contains types that are used to arrange items in the user interface +\endlist + +The \l{What's New in Qt 5.1} has more information about the Qt 5.1 release. + +\section1 Qt Quick in Qt 5.0 The \l {Qt Quick} module is new in Qt 5. It provides the visual canvas and scenegraph back-end as well as the \c QtQuick QML module for QML application development. diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp index 5709d58d58..c948d87cc0 100644 --- a/src/quick/items/context2d/qquickcontext2d.cpp +++ b/src/quick/items/context2d/qquickcontext2d.cpp @@ -2624,7 +2624,7 @@ static v8::Handle<v8::Value> ctx2d_createImageData(const v8::Arguments &args) } /*! - \qmlmethod CanvasImageData QtQuick2::Canvas::getImageData(real sx, real sy, real sw, real sh) + \qmlmethod CanvasImageData QtQuick2::Context2D::getImageData(real sx, real sy, real sw, real sh) Returns an CanvasImageData object containing the image data for the given rectangle of the canvas. */ static v8::Handle<v8::Value> ctx2d_getImageData(const v8::Arguments &args) diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index d6a663ab77..110e14d266 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -1363,7 +1363,7 @@ QQuickKeysAttached *QQuickKeysAttached::qmlAttachedProperties(QObject *obj) \brief Property used to mirror layout behavior The LayoutMirroring attached property is used to horizontally mirror \l {anchor-layout}{Item anchors}, - \l{Item Layouts}{positioner} types (such as \l Row and \l Grid) + \l{Item Positioners}{positioner} types (such as \l Row and \l Grid) and views (such as \l GridView and horizontal \l ListView). Mirroring is a visual change: left anchors become right anchors, and positioner types like \l Grid and \l Row reverse the horizontal layout of child items. @@ -1403,7 +1403,7 @@ QQuickKeysAttached *QQuickKeysAttached::qmlAttachedProperties(QObject *obj) This property holds whether the item's layout is mirrored horizontally. Setting this to true horizontally reverses \l {anchor-layout}{anchor} settings such that left anchors become right, - and right anchors become left. For \l{Item Layouts}{positioner} types + and right anchors become left. For \l{Item Positioners}{positioner} types (such as \l Row and \l Grid) and view types (such as \l {GridView}{GridView} and \l {ListView}{ListView}) this also mirrors the horizontal layout direction of the item. @@ -2050,7 +2050,10 @@ bool QQuickItemPrivate::canAcceptTabFocus(QQuickItem *item) { bool result = true; - if (item->window() && item == item->window()->contentItem()) + if (!item->window()) + return false; + + if (item == item->window()->contentItem()) return true; #ifndef QT_NO_ACCESSIBILITY @@ -2093,7 +2096,6 @@ bool QQuickItemPrivate::focusNextPrev(QQuickItem *item, bool forward) QQuickItem* QQuickItemPrivate::nextPrevItemInTabFocusChain(QQuickItem *item, bool forward) { Q_ASSERT(item); - Q_ASSERT(item->activeFocusOnTab()); bool all = QQuickItemPrivate::qt_tab_all_widgets(); @@ -2107,6 +2109,10 @@ QQuickItem* QQuickItemPrivate::nextPrevItemInTabFocusChain(QQuickItem *item, boo from = item->parentItem(); } bool skip = false; + const QQuickItem * const contentItem = item->window()->contentItem(); + const QQuickItem * const originalItem = item; + QQuickItem * startItem = item; + QQuickItem * firstFromItem = from; QQuickItem *current = item; do { skip = false; @@ -2157,8 +2163,25 @@ QQuickItem* QQuickItemPrivate::nextPrevItemInTabFocusChain(QQuickItem *item, boo skip = true; } } - from = last; + if (current == startItem && from == firstFromItem) { + // wrapped around, avoid endless loops + if (originalItem == contentItem) { +#ifdef FOCUS_DEBUG + qDebug() << "QQuickItemPrivate::nextPrevItemInTabFocusChain: looped, return contentItem"; +#endif + return item->window()->contentItem(); + } else { +#ifdef FOCUS_DEBUG + qDebug() << "QQuickItemPrivate::nextPrevItemInTabFocusChain: looped, return " << startItem; +#endif + return startItem; + } + } + if (!firstFromItem) { //start from root + startItem = current; + firstFromItem = from; + } } while (skip || !current->activeFocusOnTab() || !current->isEnabled() || !current->isVisible() || !(all || QQuickItemPrivate::canAcceptTabFocus(current))); @@ -4375,7 +4398,8 @@ void QQuickItemPrivate::deliverKeyEvent(QKeyEvent *e) return; //only care about KeyPress now - if (q->activeFocusOnTab() && e->type() == QEvent::KeyPress) { + if ((q == q->window()->contentItem() || q->activeFocusOnTab()) + && e->type() == QEvent::KeyPress) { bool res = false; if (!(e->modifiers() & (Qt::ControlModifier | Qt::AltModifier))) { //### Add MetaModifier? if (e->key() == Qt::Key_Backtab diff --git a/src/quick/items/qquickitem.h b/src/quick/items/qquickitem.h index 84eafec1d7..d7256f3568 100644 --- a/src/quick/items/qquickitem.h +++ b/src/quick/items/qquickitem.h @@ -324,7 +324,7 @@ public: Q_INVOKABLE void mapToItem(QQmlV8Function*) const; Q_INVOKABLE void forceActiveFocus(); Q_INVOKABLE void forceActiveFocus(Qt::FocusReason reason); - Q_INVOKABLE QQuickItem *nextItemInFocusChain(bool forward = true); + Q_REVISION(1) Q_INVOKABLE QQuickItem *nextItemInFocusChain(bool forward = true); Q_INVOKABLE QQuickItem *childAt(qreal x, qreal y) const; #ifndef QT_NO_IM diff --git a/src/quick/items/qquickpositioners.cpp b/src/quick/items/qquickpositioners.cpp index 789d2e62aa..b07a38cdaf 100644 --- a/src/quick/items/qquickpositioners.cpp +++ b/src/quick/items/qquickpositioners.cpp @@ -626,7 +626,7 @@ void QQuickPositionerAttached::setIsLastItem(bool isLastItem) more information about its position within the Column. For more information on using Column and other related positioner-types, see - \l{Item Layouts}. + \l{Item Positioners}. \section1 Using Transitions @@ -644,7 +644,7 @@ void QQuickPositionerAttached::setIsLastItem(bool isLastItem) \image verticalpositioner_transition.gif - \sa Row, Grid, Flow, Positioner, {Qt Quick Examples - Positioners} + \sa Row, Grid, Flow, Positioner, ColumnLayout, {Qt Quick Examples - Positioners} */ /*! \qmlproperty Transition QtQuick2::Column::populate @@ -795,10 +795,10 @@ void QQuickColumn::reportConflictingAnchors() more information about its position within the Row. For more information on using Row and other related positioner-types, see - \l{Item Layouts}. + \l{Item Positioners}. - \sa Column, Grid, Flow, Positioner, {Qt Quick Examples - Positioners} + \sa Column, Grid, Flow, Positioner, RowLayout, {Qt Quick Examples - Positioners} */ /*! \qmlproperty Transition QtQuick2::Row::populate @@ -1028,10 +1028,10 @@ void QQuickRow::reportConflictingAnchors() or anchor itself with any of the \l {Item::anchors}{anchor} properties. For more information on using Grid and other related positioner-types, see - \l{Item Layouts}. + \l{Item Positioners}. - \sa Flow, Row, Column, Positioner, {Qt Quick Examples - Positioners} + \sa Flow, Row, Column, Positioner, GridLayout, {Qt Quick Examples - Positioners} */ /*! \qmlproperty Transition QtQuick2::Grid::populate @@ -1570,7 +1570,7 @@ void QQuickGrid::reportConflictingAnchors() or anchor itself with any of the \l {Item::anchors}{anchor} properties. For more information on using Flow and other related positioner-types, see - \l{Item Layouts}. + \l{Item Positioners}. \sa Column, Row, Grid, Positioner, {Qt Quick Examples - Positioners} */ diff --git a/src/quick/items/qquickshadereffect.cpp b/src/quick/items/qquickshadereffect.cpp index 102066704b..f39a15070c 100644 --- a/src/quick/items/qquickshadereffect.cpp +++ b/src/quick/items/qquickshadereffect.cpp @@ -912,8 +912,8 @@ QSGNode *QQuickShaderEffect::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDa { QQuickShaderEffectNode *node = static_cast<QQuickShaderEffectNode *>(oldNode); - // In the case of a bad vertex shader, don't try to create a node... - if (m_common.attributes.isEmpty()) { + // In the case of zero-size or a bad vertex shader, don't try to create a node... + if (m_common.attributes.isEmpty() || width() <= 0 || height() <= 0) { if (node) delete node; return 0; diff --git a/src/quick/items/qquickshadereffectsource.cpp b/src/quick/items/qquickshadereffectsource.cpp index bd0bb2348e..9debfe35b3 100644 --- a/src/quick/items/qquickshadereffectsource.cpp +++ b/src/quick/items/qquickshadereffectsource.cpp @@ -942,7 +942,7 @@ void QQuickShaderEffectSource::releaseResources() QSGNode *QQuickShaderEffectSource::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) { - if (!m_sourceItem || m_sourceItem->width() == 0 || m_sourceItem->height() == 0) { + if (!m_sourceItem || m_sourceItem->width() <= 0 || m_sourceItem->height() <= 0) { if (m_texture) m_texture->setItem(0); delete oldNode; diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 4a34adabe8..619c72afb8 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -74,6 +74,8 @@ QT_BEGIN_NAMESPACE extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha); +bool QQuickWindowPrivate::defaultAlphaBuffer(0); + void QQuickWindowPrivate::updateFocusItemTransform() { Q_Q(QQuickWindow); @@ -87,44 +89,49 @@ void QQuickWindowPrivate::updateFocusItemTransform() #endif } - class QQuickWindowIncubationController : public QObject, public QQmlIncubationController { Q_OBJECT public: - QQuickWindowIncubationController(const QQuickWindow *window) - : m_window(QQuickWindowPrivate::get(const_cast<QQuickWindow *>(window))) + QQuickWindowIncubationController(QSGRenderLoop *loop) + : m_renderLoop(loop), m_timer(0) { // Allow incubation for 1/3 of a frame. m_incubation_time = qMax(1, int(1000 / QGuiApplication::primaryScreen()->refreshRate()) / 3); - m_animation_driver = m_window->windowManager->animationDriver(); + m_animation_driver = m_renderLoop->animationDriver(); if (m_animation_driver) { connect(m_animation_driver, SIGNAL(stopped()), this, SLOT(animationStopped())); - connect(window, SIGNAL(frameSwapped()), this, SLOT(incubate())); + connect(m_renderLoop, SIGNAL(timeToIncubate()), this, SLOT(incubate())); } } protected: - virtual bool event(QEvent *e) + void timerEvent(QTimerEvent *) { - if (e->type() == QEvent::User) { - incubate(); - return true; + killTimer(m_timer); + m_timer = 0; + incubate(); + } + + void incubateAgain() { + if (m_timer == 0) { + // Wait for a while before processing the next batch. Using a + // timer to avoid starvation of system events. + m_timer = startTimer(m_incubation_time); } - return QObject::event(e); } public slots: void incubate() { if (incubatingObjectCount()) { - if (m_animation_driver && m_animation_driver->isRunning()) { + if (m_renderLoop->interleaveIncubation()) { incubateFor(m_incubation_time); } else { incubateFor(m_incubation_time * 2); if (incubatingObjectCount()) - QCoreApplication::postEvent(this, new QEvent(QEvent::User)); + incubateAgain(); } } } @@ -134,14 +141,15 @@ public slots: protected: virtual void incubatingObjectCountChanged(int count) { - if (count && (!m_animation_driver || !m_animation_driver->isRunning())) - QCoreApplication::postEvent(this, new QEvent(QEvent::User)); + if (count && !m_renderLoop->interleaveIncubation()) + incubateAgain(); } private: - QQuickWindowPrivate *m_window; + QSGRenderLoop *m_renderLoop; int m_incubation_time; QAnimationDriver *m_animation_driver; + int m_timer; }; #include "qquickwindow.moc" @@ -347,6 +355,7 @@ QQuickWindowPrivate::QQuickWindowPrivate() , persistentGLContext(true) , persistentSceneGraph(true) , lastWheelEventAccepted(false) + , componentCompleted(true) , renderTarget(0) , renderTargetId(0) , incubationController(0) @@ -2777,7 +2786,7 @@ QQmlIncubationController *QQuickWindow::incubationController() const Q_D(const QQuickWindow); if (!d->incubationController) - d->incubationController = new QQuickWindowIncubationController(this); + d->incubationController = new QQuickWindowIncubationController(d->windowManager); return d->incubationController; } @@ -2969,7 +2978,7 @@ QSGTexture *QQuickWindow::createTextureFromId(uint id, const QSize &size, Create Setting the clear color has no effect when clearing is disabled. By default, the clear color is white. - \sa setClearBeforeRendering() + \sa setClearBeforeRendering(), setDefaultAlphaBuffer() */ void QQuickWindow::setColor(const QColor &color) @@ -2979,7 +2988,7 @@ void QQuickWindow::setColor(const QColor &color) return; if (color.alpha() != d->clearColor.alpha()) { - QSurfaceFormat fmt = format(); + QSurfaceFormat fmt = requestedFormat(); if (color.alpha() < 255) fmt.setAlphaBufferSize(8); else @@ -2997,6 +3006,31 @@ QColor QQuickWindow::color() const } /*! + \brief Returns whether to use alpha transparency on newly created windows. + + \since Qt 5.1 + \sa setDefaultAlphaBuffer() + */ +bool QQuickWindow::hasDefaultAlphaBuffer() +{ + return QQuickWindowPrivate::defaultAlphaBuffer; +} + +/*! + \brief \a useAlpha specifies whether to use alpha transparency on newly created windows. + \since Qt 5.1 + + In any application which expects to create translucent windows, it's + necessary to set this to true before creating the first QQuickWindow, + because all windows will share the same \l QOpenGLContext. The default + value is false. + */ +void QQuickWindow::setDefaultAlphaBuffer(bool useAlpha) +{ + QQuickWindowPrivate::defaultAlphaBuffer = useAlpha; +} + +/*! \qmlproperty string QtQuick.Window2::Window::title The window's title in the windowing system. diff --git a/src/quick/items/qquickwindow.h b/src/quick/items/qquickwindow.h index fc148aabe6..a0bc832334 100644 --- a/src/quick/items/qquickwindow.h +++ b/src/quick/items/qquickwindow.h @@ -115,6 +115,9 @@ public: void setColor(const QColor &color); QColor color() const; + static bool hasDefaultAlphaBuffer(); + static void setDefaultAlphaBuffer(bool useAlpha); + void setPersistentOpenGLContext(bool persistent); bool isPersistentOpenGLContext() const; diff --git a/src/quick/items/qquickwindow_p.h b/src/quick/items/qquickwindow_p.h index 9e3251b240..2dddd9ab68 100644 --- a/src/quick/items/qquickwindow_p.h +++ b/src/quick/items/qquickwindow_p.h @@ -209,6 +209,7 @@ public: uint persistentSceneGraph : 1; uint lastWheelEventAccepted : 1; + bool componentCompleted : 1; QOpenGLFramebufferObject *renderTarget; uint renderTargetId; @@ -219,6 +220,8 @@ public: mutable QQuickWindowIncubationController *incubationController; + static bool defaultAlphaBuffer; + static bool dragOverThreshold(qreal d, Qt::Axis axis, QMouseEvent *event); // data property diff --git a/src/quick/items/qquickwindowmodule.cpp b/src/quick/items/qquickwindowmodule.cpp index f826a53a29..b91edc2fd5 100644 --- a/src/quick/items/qquickwindowmodule.cpp +++ b/src/quick/items/qquickwindowmodule.cpp @@ -42,18 +42,40 @@ #include "qquickwindowmodule_p.h" #include "qquickscreen_p.h" #include <QtQuick/QQuickWindow> +#include <QtCore/QCoreApplication> +#include <QtQml/QQmlEngine> QT_BEGIN_NAMESPACE +class QQuickWindowQmlImpl : public QQuickWindow, public QQmlParserStatus +{ + Q_INTERFACES(QQmlParserStatus) + Q_OBJECT +protected: + void classBegin() { + //Give QQuickView behavior when created from QML with QQmlApplicationEngine + if (QCoreApplication::instance()->property("__qml_using_qqmlapplicationengine") == QVariant(true)) { + QQmlEngine* e = qmlEngine(this); + if (e && !e->incubationController()) + e->setIncubationController(incubationController()); + } + } + + void componentComplete() {} +}; + void QQuickWindowModule::defineModule() { const char uri[] = "QtQuick.Window"; qmlRegisterType<QQuickWindow>(uri, 2, 0, "Window"); qmlRegisterRevision<QWindow,1>(uri, 2, 1); - qmlRegisterType<QQuickWindow,1>(uri, 2, 1, "Window"); + qmlRegisterRevision<QQuickWindow,1>(uri, 2, 1);//Type moved to a subclass, but also has new members + qmlRegisterType<QQuickWindowQmlImpl>(uri, 2, 1, "Window"); qmlRegisterUncreatableType<QQuickScreen>(uri, 2, 0, "Screen", QStringLiteral("Screen can only be used via the attached property.")); } +#include "qquickwindowmodule.moc" + QT_END_NAMESPACE diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp index d3710c7bd5..61fb1bc5b9 100644 --- a/src/quick/scenegraph/qsgcontext.cpp +++ b/src/quick/scenegraph/qsgcontext.cpp @@ -47,13 +47,16 @@ #include <QtQuick/private/qsgdefaultimagenode_p.h> #include <QtQuick/private/qsgdefaultglyphnode_p.h> #include <QtQuick/private/qsgdistancefieldglyphnode_p.h> +#include <QtQuick/private/qsgdistancefieldglyphnode_p_p.h> #include <QtQuick/private/qsgshareddistancefieldglyphcache_p.h> +#include <QtQuick/QSGFlatColorMaterial> #include <QtQuick/private/qsgtexture_p.h> #include <QtQuick/private/qquickpixmapcache_p.h> #include <QGuiApplication> #include <QOpenGLContext> +#include <QQuickWindow> #include <QtGui/qopenglframebufferobject.h> #include <private/qqmlglobal_p.h> @@ -262,9 +265,35 @@ void QSGContext::initialize(QOpenGLContext *context) Q_ASSERT(!d->gl); d->gl = context; + precompileMaterials(); + emit initialized(); } +#define QSG_PRECOMPILE_MATERIAL(name) { name m; prepareMaterial(&m); } + +/* + * Some glsl compilers take their time compiling materials, and + * the way the scene graph is being processed, these materials + * get compiled when they are first taken into use. This can + * easily lead to skipped frames. By precompiling the most + * common materials, we potentially add a few milliseconds to the + * start up, and reduce the chance of avoiding skipped frames + * later on. + */ +void QSGContext::precompileMaterials() +{ + if (qEnvironmentVariableIsEmpty("QSG_NO_MATERIAL_PRELOADING")) { + QSG_PRECOMPILE_MATERIAL(QSGVertexColorMaterial); + QSG_PRECOMPILE_MATERIAL(QSGFlatColorMaterial); + QSG_PRECOMPILE_MATERIAL(QSGOpaqueTextureMaterial); + QSG_PRECOMPILE_MATERIAL(QSGTextureMaterial); + QSG_PRECOMPILE_MATERIAL(SmoothTextureMaterial); + QSG_PRECOMPILE_MATERIAL(SmoothColorMaterial); + QSG_PRECOMPILE_MATERIAL(QSGDistanceFieldTextMaterial); + } +} + /*! Returns if the scene graph context is ready or not, meaning that it has a valid @@ -398,6 +427,8 @@ QSurfaceFormat QSGContext::defaultSurfaceFormat() const QSurfaceFormat format; format.setDepthBufferSize(24); format.setStencilBufferSize(8); + if (QQuickWindow::hasDefaultAlphaBuffer()) + format.setAlphaBufferSize(8); format.setSwapBehavior(QSurfaceFormat::DoubleBuffer); return format; } diff --git a/src/quick/scenegraph/qsgcontext_p.h b/src/quick/scenegraph/qsgcontext_p.h index b069c53dd3..bbc42674c6 100644 --- a/src/quick/scenegraph/qsgcontext_p.h +++ b/src/quick/scenegraph/qsgcontext_p.h @@ -90,6 +90,7 @@ public: bool isReady() const; + virtual void precompileMaterials(); QSGMaterialShader *prepareMaterial(QSGMaterial *material); virtual void renderNextFrame(QSGRenderer *renderer, GLuint fboId); diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp index 3a608a911d..e099d94a53 100644 --- a/src/quick/scenegraph/qsgrenderloop.cpp +++ b/src/quick/scenegraph/qsgrenderloop.cpp @@ -82,7 +82,7 @@ QSGRenderLoop::~QSGRenderLoop() { } -class QSGGuiThreadRenderLoop : public QObject, public QSGRenderLoop +class QSGGuiThreadRenderLoop : public QSGRenderLoop { Q_OBJECT public: diff --git a/src/quick/scenegraph/qsgrenderloop_p.h b/src/quick/scenegraph/qsgrenderloop_p.h index b18e6f00ad..6ff9c4c5f9 100644 --- a/src/quick/scenegraph/qsgrenderloop_p.h +++ b/src/quick/scenegraph/qsgrenderloop_p.h @@ -51,8 +51,10 @@ class QQuickWindow; class QSGContext; class QAnimationDriver; -class Q_QUICK_PRIVATE_EXPORT QSGRenderLoop +class Q_QUICK_PRIVATE_EXPORT QSGRenderLoop : public QObject { + Q_OBJECT + public: virtual ~QSGRenderLoop(); @@ -77,6 +79,11 @@ public: static QSGRenderLoop *instance(); static void setInstance(QSGRenderLoop *instance); + virtual bool interleaveIncubation() const { return false; } + +signals: + void timeToIncubate(); + private: static QSGRenderLoop *s_instance; }; diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp index c4a9328ceb..bfd9a2fb20 100644 --- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp +++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp @@ -574,6 +574,7 @@ void QSGRenderThread::syncAndRender() int waitTime = vsyncDelta - (int) waitTimer.elapsed(); if (waitTime > 0) msleep(waitTime); + emit wm->timeToIncubate(); return; } @@ -600,6 +601,7 @@ void QSGRenderThread::syncAndRender() d->fireFrameSwapped(); } RLDEBUG(" Render: - rendering done"); + emit wm->timeToIncubate(); #ifndef QSG_NO_RENDER_TIMING if (qsg_render_timing) @@ -723,7 +725,7 @@ QSGContext *QSGThreadedRenderLoop::sceneGraphContext() const return m_thread->sg; } -bool QSGThreadedRenderLoop::anyoneShowing() +bool QSGThreadedRenderLoop::anyoneShowing() const { for (int i=0; i<m_windows.size(); ++i) { QQuickWindow *c = m_windows.at(i).window; @@ -733,6 +735,11 @@ bool QSGThreadedRenderLoop::anyoneShowing() return false; } +bool QSGThreadedRenderLoop::interleaveIncubation() const +{ + return m_animation_driver->isRunning() && anyoneShowing(); +} + void QSGThreadedRenderLoop::animationStarted() { RLDEBUG("GUI: animationStarted()"); @@ -1011,7 +1018,6 @@ void QSGThreadedRenderLoop::polishAndSync() RLDEBUG("GUI: - animations advancing"); m_animation_driver->advance(); RLDEBUG("GUI: - animations done"); - // We need to trigger another sync to keep animations running... maybePostPolishRequest(); } else if (m_sync_triggered_update) { @@ -1032,7 +1038,7 @@ void QSGThreadedRenderLoop::polishAndSync() polishTime, waitTime - polishTime, syncTime - waitTime, - timer.elapsed() - syncTime); + timer.nsecsElapsed() - syncTime); } #endif } diff --git a/src/quick/scenegraph/qsgthreadedrenderloop_p.h b/src/quick/scenegraph/qsgthreadedrenderloop_p.h index aab0e8726f..6ff5cabf43 100644 --- a/src/quick/scenegraph/qsgthreadedrenderloop_p.h +++ b/src/quick/scenegraph/qsgthreadedrenderloop_p.h @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE class QSGRenderThread; -class QSGThreadedRenderLoop : public QObject, public QSGRenderLoop +class QSGThreadedRenderLoop : public QSGRenderLoop { Q_OBJECT public: @@ -79,7 +79,7 @@ public: bool event(QEvent *); - void wakeup(); + bool interleaveIncubation() const; public slots: void animationStarted(); @@ -91,7 +91,7 @@ private: void releaseResources(QQuickWindow *window, bool inDestructor); bool checkAndResetForceUpdate(QQuickWindow *window); - bool anyoneShowing(); + bool anyoneShowing() const; void initialize(); void maybePostPolishRequest(); diff --git a/src/quick/scenegraph/qsgwindowsrenderloop.cpp b/src/quick/scenegraph/qsgwindowsrenderloop.cpp index ce43ccf531..8e97f65ea5 100644 --- a/src/quick/scenegraph/qsgwindowsrenderloop.cpp +++ b/src/quick/scenegraph/qsgwindowsrenderloop.cpp @@ -102,6 +102,11 @@ QSGWindowsRenderLoop::QSGWindowsRenderLoop() #endif } +bool QSGWindowsRenderLoop::interleaveIncubation() const +{ + return m_animationDriver->isRunning() && anyoneShowing(); +} + QSGWindowsRenderLoop::WindowData *QSGWindowsRenderLoop::windowData(QQuickWindow *window) { for (int i=0; i<m_windows.size(); ++i) { @@ -390,6 +395,8 @@ void QSGWindowsRenderLoop::render() // and thus another render pass, so to keep things running, // make sure there is another frame pending. maybePostUpdateTimer(); + + emit timeToIncubate(); } } diff --git a/src/quick/scenegraph/qsgwindowsrenderloop_p.h b/src/quick/scenegraph/qsgwindowsrenderloop_p.h index dc3a409cd5..218e18c3e2 100644 --- a/src/quick/scenegraph/qsgwindowsrenderloop_p.h +++ b/src/quick/scenegraph/qsgwindowsrenderloop_p.h @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE -class QSGWindowsRenderLoop : public QObject, public QSGRenderLoop +class QSGWindowsRenderLoop : public QSGRenderLoop { Q_OBJECT public: @@ -80,6 +80,9 @@ public: void resize(QQuickWindow *, const QSize &) { } bool event(QEvent *event); + bool anyoneShowing() const; + + bool interleaveIncubation() const; public slots: void started(); @@ -93,7 +96,6 @@ private: void handleObscurity(); void maybePostUpdateTimer(); - bool anyoneShowing() const; WindowData *windowData(QQuickWindow *window); QList<WindowData> m_windows; diff --git a/sync.profile b/sync.profile index bddfd0f7f3..3efcbca8e1 100644 --- a/sync.profile +++ b/sync.profile @@ -15,9 +15,10 @@ # Each of the module version specifiers can take one of the following values: # - A specific Git revision. # - any git symbolic ref resolvable from the module's repository (e.g. "refs/heads/master" to track master branch) +# - an empty string to use the same branch under test (dependencies will become "refs/heads/master" if we are in the master branch) # %dependencies = ( - "qtbase" => "refs/heads/stable", - "qtxmlpatterns" => "refs/heads/stable", - "qtjsbackend" => "refs/heads/stable", + "qtbase" => "", + "qtxmlpatterns" => "", + "qtjsbackend" => "", ); diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp index 21fc48117f..e4f886f7ce 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp +++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp @@ -283,7 +283,7 @@ void QQmlProfilerClient::messageReceived(const QByteArray &message) case QQmlProfilerClient::SceneGraphWindowsRenderShow: stream >> subtime_1 >> subtime_2 >> subtime_3; break; // WindowsAnimations: update time case QQmlProfilerClient::SceneGraphWindowsAnimations: stream >> subtime_1; break; - // WindowsRenderWindow: polish time, sync time, render time, swap time + // WindowsRenderWindow: polish time case QQmlProfilerClient::SceneGraphWindowsPolishFrame: stream >> subtime_1; break; } break; diff --git a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp index 327716f1b5..ca212d333b 100644 --- a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp +++ b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp @@ -66,6 +66,8 @@ private slots: void crashBug(); void QTBUG_17868(); void metaObjectAccessibility(); + void QTBUG_31226(); + void QTBUG_29836(); }; void tst_QQmlPropertyMap::insert() @@ -286,13 +288,17 @@ class MyEnhancedPropertyMap : public QQmlPropertyMap { Q_OBJECT public: - MyEnhancedPropertyMap() : QQmlPropertyMap(this, 0) {} + MyEnhancedPropertyMap() : QQmlPropertyMap(this, 0), m_testSlotCalled(false) {} + bool testSlotCalled() const { return m_testSlotCalled; } signals: void testSignal(); public slots: - void testSlot() {} + void testSlot() { m_testSlotCalled = true; } + +private: + bool m_testSlotCalled; }; void tst_QQmlPropertyMap::metaObjectAccessibility() @@ -312,6 +318,57 @@ void tst_QQmlPropertyMap::metaObjectAccessibility() QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString())); } +void tst_QQmlPropertyMap::QTBUG_31226() +{ + /* Instantiate a property map from QML, and verify that property changes + * made from C++ are visible from QML */ + QQmlEngine engine; + QQmlContext context(&engine); + qmlRegisterType<QQmlPropertyMap>("QTBUG_31226", 1, 0, "PropertyMap"); + QQmlComponent c(&engine); + c.setData("import QtQuick 2.0\nimport QTBUG_31226 1.0\n" + "Item {\n" + " property string myProp\n" + " PropertyMap { id: qmlPropertyMap; objectName: \"qmlPropertyMap\" }\n" + " Timer { interval: 5; running: true; onTriggered: { myProp = qmlPropertyMap.greeting; } }\n" + "}", + QUrl()); + QObject *obj = c.create(&context); + QVERIFY(obj); + + QQmlPropertyMap *qmlPropertyMap = obj->findChild<QQmlPropertyMap*>(QString("qmlPropertyMap")); + QVERIFY(qmlPropertyMap); + + qmlPropertyMap->insert("greeting", QString("Hello world!")); + QTRY_COMPARE(obj->property("myProp").toString(), QString("Hello world!")); + + delete obj; + +} + +void tst_QQmlPropertyMap::QTBUG_29836() +{ + MyEnhancedPropertyMap map; + QCOMPARE(map.testSlotCalled(), false); + + QQmlEngine engine; + QQmlContext context(&engine); + context.setContextProperty("enhancedMap", &map); + QQmlComponent c(&engine); + c.setData("import QtQuick 2.0\n" + "Item {\n" + " Timer { interval: 5; running: true; onTriggered: enhancedMap.testSlot() }\n" + "}", + QUrl()); + QObject *obj = c.create(&context); + QVERIFY(obj); + + QTRY_COMPARE(map.testSlotCalled(), true); + + delete obj; + +} + QTEST_MAIN(tst_QQmlPropertyMap) #include "tst_qqmlpropertymap.moc" diff --git a/tests/auto/quick/examples/tst_examples.cpp b/tests/auto/quick/examples/tst_examples.cpp index 9c5fb88af2..7ef07e4896 100644 --- a/tests/auto/quick/examples/tst_examples.cpp +++ b/tests/auto/quick/examples/tst_examples.cpp @@ -89,6 +89,7 @@ tst_examples::tst_examples() // Add files to exclude here excludedFiles << "examples/quick/canvas/tiger/tiger.qml"; // QTBUG-26528 excludedFiles << "snippets/qml/listmodel/listmodel.qml"; //Just a ListModel, no root QQuickItem + excludedFiles << "examples/quick/demos/photosurface/photosurface.qml"; // root item is Window rather than Item // Add directories you want excluded here (don't add examples/, because they install to examples/qtdeclarative/) excludedDirs << "shared"; //Not an example diff --git a/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp b/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp index 201287b2a8..0377eaa71d 100644 --- a/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp +++ b/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp @@ -201,26 +201,28 @@ void tst_qquickanimatedimage::mirror_notRunning() QFETCH(QUrl, fileUrl); QQuickView window; + window.setSource(fileUrl); window.show(); + QTRY_VERIFY(window.isExposed()); - window.setSource(fileUrl); QQuickAnimatedImage *anim = qobject_cast<QQuickAnimatedImage *>(window.rootObject()); QVERIFY(anim); int width = anim->property("width").toInt(); - QPixmap screenshot = QPixmap::fromImage(window.grabWindow()); + QImage screenshot = window.grabWindow(); QTransform transform; transform.translate(width, 0).scale(-1, 1.0); - QPixmap expected = screenshot.transformed(transform); + QImage expected = screenshot.transformed(transform); int frame = anim->currentFrame(); bool playing = anim->isPlaying(); bool paused = anim->isPlaying(); anim->setProperty("mirror", true); - screenshot = QPixmap::fromImage(window.grabWindow()); + screenshot = window.grabWindow(); + screenshot.save("screen.png"); QCOMPARE(screenshot, expected); // mirroring should not change the current frame or playing status diff --git a/tests/auto/quick/qquickitem2/data/activeFocusOnTab7.qml b/tests/auto/quick/qquickitem2/data/activeFocusOnTab7.qml new file mode 100644 index 0000000000..e81d9be950 --- /dev/null +++ b/tests/auto/quick/qquickitem2/data/activeFocusOnTab7.qml @@ -0,0 +1,36 @@ +import QtQuick 2.1 + +Item { + id: main + objectName: "main" + width: 300 + height: 300 + Item { + id: button1 + objectName: "button1" + width: 300 + height: 150 + activeFocusOnTab: true + Accessible.role: Accessible.Button + Rectangle { + anchors.fill: parent + color: parent.activeFocus ? "red" : "black" + } + anchors.top: parent.top + anchors.left: parent.left + } + Item { + id: button2 + objectName: "button2" + width: 300 + height: 150 + activeFocusOnTab: true + Accessible.role: Accessible.Button + Rectangle { + anchors.fill: parent + color: parent.activeFocus ? "red" : "black" + } + anchors.bottom: parent.bottom + anchors.left: parent.left + } +} diff --git a/tests/auto/quick/qquickitem2/data/activeFocusOnTab8.qml b/tests/auto/quick/qquickitem2/data/activeFocusOnTab8.qml new file mode 100644 index 0000000000..641a39c1fa --- /dev/null +++ b/tests/auto/quick/qquickitem2/data/activeFocusOnTab8.qml @@ -0,0 +1,36 @@ +import QtQuick 2.1 + +Item { + id: main + objectName: "main" + width: 300 + height: 300 + Item { + id: button1 + objectName: "button1" + width: 300 + height: 150 + activeFocusOnTab: true + Accessible.role: Accessible.Table + Rectangle { + anchors.fill: parent + color: parent.activeFocus ? "red" : "black" + } + anchors.top: parent.top + anchors.left: parent.left + } + Item { + id: button2 + objectName: "button2" + width: 300 + height: 150 + activeFocusOnTab: true + Accessible.role: Accessible.Table + Rectangle { + anchors.fill: parent + color: parent.activeFocus ? "red" : "black" + } + anchors.bottom: parent.bottom + anchors.left: parent.left + } +} diff --git a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp index 9a6bed6dbe..992e81aa64 100644 --- a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp +++ b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp @@ -71,6 +71,8 @@ private slots: void activeFocusOnTab4(); void activeFocusOnTab5(); void activeFocusOnTab6(); + void activeFocusOnTab7(); + void activeFocusOnTab8(); void nextItemInFocusChain(); void nextItemInFocusChain2(); @@ -747,6 +749,91 @@ void tst_QQuickItem::activeFocusOnTab6() delete window; } +void tst_QQuickItem::activeFocusOnTab7() +{ + if (qt_tab_all_widgets()) + QSKIP("This function doesn't support iterating all."); + + QQuickView *window = new QQuickView(0); + window->setBaseSize(QSize(300,300)); + + window->setSource(testFileUrl("activeFocusOnTab7.qml")); + window->show(); + window->requestActivate(); + QVERIFY(QTest::qWaitForWindowActive(window)); + QVERIFY(QGuiApplication::focusWindow() == window); + + QQuickItem *item = findItem<QQuickItem>(window->rootObject(), "button1"); + QVERIFY(item); + item->forceActiveFocus(); + QVERIFY(item->hasActiveFocus()); + + // Tab: button1->button1 + QKeyEvent key(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1); + QGuiApplication::sendEvent(window, &key); + QVERIFY(!key.isAccepted()); + + QVERIFY(item->hasActiveFocus()); + + // BackTab: button1->button1 + key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1); + QGuiApplication::sendEvent(window, &key); + QVERIFY(!key.isAccepted()); + + QVERIFY(item->hasActiveFocus()); + + delete window; +} + +void tst_QQuickItem::activeFocusOnTab8() +{ + QQuickView *window = new QQuickView(0); + window->setBaseSize(QSize(300,300)); + + window->setSource(testFileUrl("activeFocusOnTab8.qml")); + window->show(); + window->requestActivate(); + QVERIFY(QTest::qWaitForWindowActive(window)); + QVERIFY(QGuiApplication::focusWindow() == window); + + QQuickItem *content = window->contentItem(); + QVERIFY(content); + QVERIFY(content->hasActiveFocus()); + + QQuickItem *button1 = findItem<QQuickItem>(window->rootObject(), "button1"); + QVERIFY(button1); + QVERIFY(!button1->hasActiveFocus()); + + QQuickItem *button2 = findItem<QQuickItem>(window->rootObject(), "button2"); + QVERIFY(button2); + QVERIFY(!button2->hasActiveFocus()); + + // Tab: contentItem->button1 + QKeyEvent key(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1); + QGuiApplication::sendEvent(window, &key); + QVERIFY(key.isAccepted()); + + QVERIFY(button1->hasActiveFocus()); + + // Tab: button1->button2 + key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1); + QGuiApplication::sendEvent(window, &key); + QVERIFY(key.isAccepted()); + + QVERIFY(button2->hasActiveFocus()); + QVERIFY(!button1->hasActiveFocus()); + + // BackTab: button2->button1 + key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1); + QGuiApplication::sendEvent(window, &key); + QVERIFY(key.isAccepted()); + + QVERIFY(button1->hasActiveFocus()); + QVERIFY(!button2->hasActiveFocus()); + + delete window; +} + void tst_QQuickItem::nextItemInFocusChain() { if (!qt_tab_all_widgets()) diff --git a/tests/auto/quick/touchmouse/touchmouse.pro b/tests/auto/quick/touchmouse/touchmouse.pro index bba0abdc17..378e199bf5 100644 --- a/tests/auto/quick/touchmouse/touchmouse.pro +++ b/tests/auto/quick/touchmouse/touchmouse.pro @@ -13,8 +13,6 @@ TESTDATA = data/* # OTHER_FILES += data/foo.qml -CONFIG += parallel_test - DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 mac:CONFIG+=insignificant_test # QTBUG-27890 diff --git a/tests/auto/quick/touchmouse/tst_touchmouse.cpp b/tests/auto/quick/touchmouse/tst_touchmouse.cpp index 15a4f0cc27..4779942406 100644 --- a/tests/auto/quick/touchmouse/tst_touchmouse.cpp +++ b/tests/auto/quick/touchmouse/tst_touchmouse.cpp @@ -195,8 +195,9 @@ void tst_TouchMouse::simpleTouchEvent() window->setSource(testFileUrl("singleitem.qml")); window->show(); - window->requestActivate(); QVERIFY(QTest::qWaitForWindowExposed(window)); + window->requestActivate(); + QVERIFY(QTest::qWaitForWindowActive(window)); QVERIFY(window->rootObject() != 0); EventItem *eventItem1 = window->rootObject()->findChild<EventItem*>("eventItem1"); @@ -344,7 +345,9 @@ void tst_TouchMouse::mouse() window->setSource(testFileUrl("twoitems.qml")); window->show(); + QVERIFY(QTest::qWaitForWindowExposed(window)); window->requestActivate(); + QVERIFY(QTest::qWaitForWindowActive(window)); QVERIFY(window->rootObject() != 0); EventItem *eventItem1 = window->rootObject()->findChild<EventItem*>("eventItem1"); @@ -376,7 +379,9 @@ void tst_TouchMouse::touchOverMouse() window->setSource(testFileUrl("twoitems.qml")); window->show(); + QVERIFY(QTest::qWaitForWindowExposed(window)); window->requestActivate(); + QVERIFY(QTest::qWaitForWindowActive(window)); QVERIFY(window->rootObject() != 0); EventItem *eventItem1 = window->rootObject()->findChild<EventItem*>("eventItem1"); @@ -417,7 +422,9 @@ void tst_TouchMouse::mouseOverTouch() window->setSource(testFileUrl("twoitems.qml")); window->show(); + QVERIFY(QTest::qWaitForWindowExposed(window)); window->requestActivate(); + QVERIFY(QTest::qWaitForWindowActive(window)); QVERIFY(window->rootObject() != 0); EventItem *eventItem1 = window->rootObject()->findChild<EventItem*>("eventItem1"); @@ -461,7 +468,9 @@ void tst_TouchMouse::buttonOnFlickable() window->setSource(testFileUrl("buttononflickable.qml")); window->show(); + QVERIFY(QTest::qWaitForWindowExposed(window)); window->requestActivate(); + QVERIFY(QTest::qWaitForWindowActive(window)); QVERIFY(window->rootObject() != 0); QQuickFlickable *flickable = window->rootObject()->findChild<QQuickFlickable*>("flickable"); @@ -569,7 +578,9 @@ void tst_TouchMouse::buttonOnTouch() QQuickView *window = createView(); window->setSource(testFileUrl("buttonontouch.qml")); window->show(); + QVERIFY(QTest::qWaitForWindowExposed(window)); window->requestActivate(); + QVERIFY(QTest::qWaitForWindowActive(window)); QVERIFY(window->rootObject() != 0); QQuickPinchArea *pinchArea = window->rootObject()->findChild<QQuickPinchArea*>("pincharea"); @@ -691,7 +702,9 @@ void tst_TouchMouse::pinchOnFlickable() QQuickView *window = createView(); window->setSource(testFileUrl("pinchonflickable.qml")); window->show(); + QVERIFY(QTest::qWaitForWindowExposed(window)); window->requestActivate(); + QVERIFY(QTest::qWaitForWindowActive(window)); QVERIFY(window->rootObject() != 0); QQuickPinchArea *pinchArea = window->rootObject()->findChild<QQuickPinchArea*>("pincharea"); @@ -758,7 +771,9 @@ void tst_TouchMouse::flickableOnPinch() QQuickView *window = createView(); window->setSource(testFileUrl("flickableonpinch.qml")); window->show(); + QVERIFY(QTest::qWaitForWindowExposed(window)); window->requestActivate(); + QVERIFY(QTest::qWaitForWindowActive(window)); QVERIFY(window->rootObject() != 0); QQuickPinchArea *pinchArea = window->rootObject()->findChild<QQuickPinchArea*>("pincharea"); @@ -935,8 +950,9 @@ void tst_TouchMouse::tapOnDismissiveTopMouseAreaClicksBottomOne() window->setSource(testFileUrl("twoMouseAreas.qml")); window->show(); - window->requestActivate(); QVERIFY(QTest::qWaitForWindowExposed(window)); + window->requestActivate(); + QVERIFY(QTest::qWaitForWindowActive(window)); QVERIFY(window->rootObject() != 0); QQuickMouseArea *bottomMouseArea = diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp index d572487218..8a48445d63 100644 --- a/tools/qmlscene/main.cpp +++ b/tools/qmlscene/main.cpp @@ -483,7 +483,9 @@ int main(int argc, char ** argv) QObject *topLevel = component->create(); QQuickWindow *window = qobject_cast<QQuickWindow *>(topLevel); QQuickView* qxView = 0; - if (!window) { + if (window) { + engine.setIncubationController(window->incubationController()); + } else { QQuickItem *contentItem = qobject_cast<QQuickItem *>(topLevel); if (contentItem) { qxView = new QQuickView(&engine, NULL); |