diff --git a/dist/changes-5.1.0 b/dist/changes-5.1.0 index 50bdc2f9f8e0adac38c73229072097d79984c0cf..8633d22eef64816c6d0fb5bcc1555ceb93115034 100644 --- a/dist/changes-5.1.0 +++ b/dist/changes-5.1.0 @@ -43,6 +43,9 @@ Third party components 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). + + - tryCompare now correctly fails when it only gets two parameters + **************************************************************************** * Library * **************************************************************************** diff --git a/examples/quick/demos/calqlatr/calqlatr.pro b/examples/quick/demos/calqlatr/calqlatr.pro index 1b002a5f271da745fe0c7d1d3aa5b5745fab4b28..91d52a293e5de43db887c54cbbb94eb4ab7415e4 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 16b2e197244dce005ebbc129e62d6759b5a2bc45..0a092c25daf819b5f68c0c461acf2fca8e53cefa 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 4a78a3ebcd1d3a64e1b50e3daa00424f52ed0258..ec8edfea665447c7461b533df754adad3f48a69b 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 3203e18431a86d544ffddf941d4b37741f0bc10b..c7f268065102a9fed3a3b063f705684744fa3fb5 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 d86fecbf3943f7c95e29901c258f1fcef4cb5aee..da8e940b16b5d808761bc06d9bab54a9cfced485 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/dialogs/ColorDialogs.qml b/examples/quick/dialogs/colorandfiledialogs/ColorDialogs.qml similarity index 99% rename from examples/quick/dialogs/ColorDialogs.qml rename to examples/quick/dialogs/colorandfiledialogs/ColorDialogs.qml index f3d253aa8c01b9f02306bc8eaf533d92d817dc58..6a0af7f730f06cc719f305775bc5517300766b96 100644 --- a/examples/quick/dialogs/ColorDialogs.qml +++ b/examples/quick/dialogs/colorandfiledialogs/ColorDialogs.qml @@ -49,6 +49,7 @@ Rectangle { SystemPalette { id: palette } clip: true + //! [colordialog] ColorDialog { id: colorDialog visible: colorDialogVisible.checked @@ -59,6 +60,7 @@ Rectangle { onAccepted: { console.log("Accepted: " + color) } onRejected: { console.log("Rejected") } } + //! [colordialog] Column { anchors.fill: parent diff --git a/examples/quick/dialogs/FileDialogs.qml b/examples/quick/dialogs/colorandfiledialogs/FileDialogs.qml similarity index 99% rename from examples/quick/dialogs/FileDialogs.qml rename to examples/quick/dialogs/colorandfiledialogs/FileDialogs.qml index 8ed64b0b3c693f96128ede00090d4888eed984b1..d1278609f9d452f92db5a0971b916ce3b91cc8b7 100644 --- a/examples/quick/dialogs/FileDialogs.qml +++ b/examples/quick/dialogs/colorandfiledialogs/FileDialogs.qml @@ -49,6 +49,7 @@ Rectangle { SystemPalette { id: palette } clip: true + //! [filedialog] FileDialog { id: fileDialog visible: fileDialogVisible.checked @@ -63,6 +64,7 @@ Rectangle { onAccepted: { console.log("Accepted: " + fileUrls) } onRejected: { console.log("Rejected") } } + //! [filedialog] Column { anchors.fill: parent diff --git a/examples/quick/dialogs/colorandfiledialogs/colorandfiledialogs.pro b/examples/quick/dialogs/colorandfiledialogs/colorandfiledialogs.pro new file mode 100644 index 0000000000000000000000000000000000000000..3a7b25c91af352e42e91759cb375777463f5d9b4 --- /dev/null +++ b/examples/quick/dialogs/colorandfiledialogs/colorandfiledialogs.pro @@ -0,0 +1,17 @@ +TEMPLATE = app + +QT += quick qml +SOURCES += main.cpp +RESOURCES += colorandfiledialogs.qrc ../../shared/shared.qrc + +OTHER_FILES += \ + dialogs.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/dialogs/dialogs.qrc b/examples/quick/dialogs/colorandfiledialogs/colorandfiledialogs.qrc similarity index 100% rename from examples/quick/dialogs/dialogs.qrc rename to examples/quick/dialogs/colorandfiledialogs/colorandfiledialogs.qrc diff --git a/examples/quick/dialogs/dialogs.qml b/examples/quick/dialogs/colorandfiledialogs/dialogs.qml similarity index 100% rename from examples/quick/dialogs/dialogs.qml rename to examples/quick/dialogs/colorandfiledialogs/dialogs.qml diff --git a/examples/quick/dialogs/colorandfiledialogs/doc/images/qml-colorandfiledialogs-example.jpg b/examples/quick/dialogs/colorandfiledialogs/doc/images/qml-colorandfiledialogs-example.jpg new file mode 100644 index 0000000000000000000000000000000000000000..4517a39308a3e5015a2e8329e44865edb56a50fd Binary files /dev/null and b/examples/quick/dialogs/colorandfiledialogs/doc/images/qml-colorandfiledialogs-example.jpg differ diff --git a/examples/quick/dialogs/colorandfiledialogs/doc/src/colorandfiledialogs.qdoc b/examples/quick/dialogs/colorandfiledialogs/doc/src/colorandfiledialogs.qdoc new file mode 100644 index 0000000000000000000000000000000000000000..68804649a9692bd855c52094c4113813abc1ffa7 --- /dev/null +++ b/examples/quick/dialogs/colorandfiledialogs/doc/src/colorandfiledialogs.qdoc @@ -0,0 +1,44 @@ +/**************************************************************************** +** +** 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 ColorDialog and FileDialog Examples + \example colorandfiledialogs + \brief This example demonstrates the color and file dialog types in QML + \image qml-colorandfiledialogs-example.jpg + \ingroup qtquickdialog_examples + + This example demonstrates the color and file 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 colorandfiledialogs/FileDialogs.qml filedialog + + A \l ColorDialog is used to choose a color, with or without alpha (transparency) + depending on how it is configured. + \snippet colorandfiledialogs/ColorDialogs.qml colordialog +*/ diff --git a/examples/quick/dialogs/main.cpp b/examples/quick/dialogs/colorandfiledialogs/main.cpp similarity index 98% rename from examples/quick/dialogs/main.cpp rename to examples/quick/dialogs/colorandfiledialogs/main.cpp index bbf0c481043755dbd1e3b524e5b24680c86c1ccc..e8c2ae6aaa66fa762667c064a69ec5e05e213f54 100644 --- a/examples/quick/dialogs/main.cpp +++ b/examples/quick/dialogs/colorandfiledialogs/main.cpp @@ -37,5 +37,5 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "../shared/shared.h" +#include "../../shared/shared.h" DECLARATIVE_EXAMPLE_MAIN(dialogs/dialogs) diff --git a/examples/quick/dialogs/dialogs.pro b/examples/quick/dialogs/dialogs.pro index b76f396e9d5fab7e485ff5ad2936f08eb7903f97..275e36470f580f1faa0da3a6564c2c7b18620ab3 100644 --- a/examples/quick/dialogs/dialogs.pro +++ b/examples/quick/dialogs/dialogs.pro @@ -1,17 +1,4 @@ -TEMPLATE = app +TEMPLATE = subdirs -QT += quick qml -SOURCES += main.cpp -RESOURCES += dialogs.qrc ../shared/shared.qrc - -OTHER_FILES += \ - dialogs.qml \ - FileDialogs.qml \ - ColorDialogs.qml - -EXAMPLE_FILES = \ - FileDialogs.qml \ - ColorDialogs.qml - -target.path = $$[QT_INSTALL_EXAMPLES]/quick/dialogs -INSTALLS += target +SUBDIRS = \ + colorandfiledialogs diff --git a/examples/quick/window/Splash.qml b/examples/quick/window/Splash.qml index 092e6e6fc28b82e8b7429a9aaadd0c6c41282668..c981bd2585000a49eff9041d791ec43523dd31c1 100644 --- a/examples/quick/window/Splash.qml +++ b/examples/quick/window/Splash.qml @@ -43,6 +43,7 @@ import QtQuick.Window 2.1 //! [splash-properties] Window { + id: splash visible: true width: splashImage.width height: splashImage.height @@ -50,7 +51,8 @@ Window { title: "Splash Window" modality: Qt.ApplicationModal flags: Qt.SplashScreen - property int timeout: 2000 + property int timeoutInterval: 2000 + signal timeout //! [splash-properties] //! [screen-properties] x: (Screen.width - splashImage.width) / 2 @@ -67,8 +69,11 @@ Window { } //! [timer] Timer { - interval: timeout; running: true; repeat: false - onTriggered: visible = false + interval: timeoutInterval; running: true; repeat: false + onTriggered: { + visible = false + splash.timeout() + } } //! [timer] } diff --git a/examples/quick/window/main.cpp b/examples/quick/window/main.cpp index 2223c607b487b334d097bcdfce1cad8e4a1b376c..7872c7183cb5b862896f340fc822efcf08c06cfa 100644 --- a/examples/quick/window/main.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,6 +50,7 @@ int main(int argc, char* argv[]) QGuiApplication app(argc, argv); QQmlEngine engine; QQmlComponent component(&engine); + QQuickWindow::setDefaultAlphaBuffer(true); component.loadUrl(QUrl("qrc:///window/window.qml")); if ( component.isReady() ) component.create(); diff --git a/examples/quick/window/window.qml b/examples/quick/window/window.qml index 1d7282f7a1ae9fe1703c199e4e325b306f3fa4ba..67e2ba40ff7776b4f56367b2cae270d159f54ecc 100644 --- a/examples/quick/window/window.qml +++ b/examples/quick/window/window.qml @@ -46,14 +46,11 @@ QtObject { property real defaultSpacing: 10 property SystemPalette palette: SystemPalette { } - property var splashWindow: Splash { } - property var controlWindow: Window { width: 400 height: col.implicitHeight + defaultSpacing * 2 color: palette.window title: "Control Window" - visible: true Column { id: col anchors.fill: parent @@ -177,4 +174,8 @@ QtObject { } } } + + property var splashWindow: Splash { + onTimeout: controlWindow.visible = true + } } diff --git a/src/imports/dialogs/dialogs.pro b/src/imports/dialogs/dialogs.pro index b7704dadda3b625fbb90afabb782d892826d2c3d..53cad30cee18aad0cc7ea491653ad6e1b64de523 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 \ diff --git a/src/imports/dialogs/doc/qtquickdialogs.qdocconf b/src/imports/dialogs/doc/qtquickdialogs.qdocconf new file mode 100644 index 0000000000000000000000000000000000000000..5caa1c05884c29d26bb2d4a1dd38ad6986473f9e --- /dev/null +++ b/src/imports/dialogs/doc/qtquickdialogs.qdocconf @@ -0,0 +1,37 @@ +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 +qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.selectors = fake:qmlclass +qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.sortPages = true +qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.type = manual + +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 0000000000000000000000000000000000000000..ee277f48dc65bb0d77972e1f23dc91ac5d355055 --- /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 0000000000000000000000000000000000000000..5a1223b04dbd13f334b8b4a3e3952d2181b95e7b --- /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/plugin.cpp b/src/imports/dialogs/plugin.cpp index bee0ee00bc153d6670f2637d848e90f27ec3afbb..5502a65310d579ff40355b65745d6d4739d9c9c1 100644 --- a/src/imports/dialogs/plugin.cpp +++ b/src/imports/dialogs/plugin.cpp @@ -55,33 +55,6 @@ QT_BEGIN_NAMESPACE - -/*! - \group dialogs - \title Dialogs -*/ - -/*! - \page qtquickdialogs-index.html - \title Qt Quick Dialogs - - \brief Qt Quick Dialogs submodule - - The submodule is new in Qt 5.1. - - \section1 Dialogs - - \annotatedlist dialogs - - \section1 Related information - - \section2 Reference - \list - \li \l{Qt Quick Dialogs QML Types}{Qt Quick Dialogs QML Types} - \endlist - -*/ - /*! \qmlmodule QtQuick.Dialogs 1 \title Qt Quick Dialogs QML Types diff --git a/src/imports/testlib/TestCase.qml b/src/imports/testlib/TestCase.qml index 7584241ca6648624a5323180b3de15e1c568da82..0bec4cddf221cea56f8f70c7da55d6dc14390eb8 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/plugins/accessible/quick/qaccessiblequickview.cpp b/src/plugins/accessible/quick/qaccessiblequickview.cpp index b85f23c48b7f6e31a1e53e444bdc20694f754f70..1240b2ef4c41dc1bf1f845b3edb0d7fb87aaec3a 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 c649370680df38b974acf359a6019cc01b3149e5..b82e1850f7489d40ea6c79a42e547e1a09b17a8b 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/doc/src/whatsnew.qdoc b/src/qml/doc/src/whatsnew.qdoc index 6ca979db374f54b37d90886fc2b4c51c00649c7a..38713a19764e9e0905f67a49a87a5fc7d584699b 100644 --- a/src/qml/doc/src/whatsnew.qdoc +++ b/src/qml/doc/src/whatsnew.qdoc @@ -29,7 +29,28 @@ \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. +\endlist + +\section2 New Submodules + +The Qt QML Models is a new submodule in Qt 5.1 and provides several QML types +for handling data with models and lists. + +\list +\li \l{QtQml.Models}{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. diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp index 9277b6ea8f81e5f3f6e4e92194cb97c339be9578..5ddc0f52bd2c595ecbb4e2f0e6b7569aeafc4e49 100644 --- a/src/qml/types/qqmllistmodel.cpp +++ b/src/qml/types/qqmllistmodel.cpp @@ -1431,7 +1431,9 @@ QQmlListModelParser::ListInstruction *QQmlListModelParser::ListModelData::instru 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 + This type is also available in the \c {QtQuick 2} import. + + \sa {QtQml2::ListModel}{Full documentation for ListModel} */ /*! \qmltype ListModel @@ -2540,7 +2542,9 @@ bool QQmlListModelParser::definesEmptyList(const QString &s) 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 + This type is also available in the \c {QtQuick 2} import. + + \sa {QtQml2::ListElement}{Full documentation for ListElement} */ /*! \qmltype ListElement diff --git a/src/quick/doc/qtquick.qdocconf b/src/quick/doc/qtquick.qdocconf index fba4ff89df6b3628f3f49ceda7c31735cd064c9f..a27b0f82f73f449b7bd57c5199f8111d50e5ec59 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,6 @@ sourcedirs += ../../imports #add plugins directory because of dependencies headerdirs += ../../plugins sourcedirs += ../../plugins + +#exclude certain directories +excludedirs = ../../imports/dialogs diff --git a/src/quick/doc/src/concepts/positioning/layouts.qdoc b/src/quick/doc/src/concepts/positioning/layouts.qdoc index 785bcc6ca6b71ff0aff9c3af796414f31abf4e89..35be2f6235429a89f84b435bbf3167b907b9c28d 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 25fc6eaab78b5e2397b85dd4b1e22cce2548331c..bae6a7f71b94cfecc509ac776f53804156fe49fb 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 d580ba8c965b07cc9b2925280c6b5983aea24419..bb488ac2f22b9f33bf3ffc467153122f9019bae0 100644 --- a/src/quick/doc/src/qmltypereference.qdoc +++ b/src/quick/doc/src/qmltypereference.qdoc @@ -236,11 +236,11 @@ Animation paths Models And Model Data \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 {QtQml2::ListModel}{ListModel} - Defines a list of data +\li \l {QtQml2::ListElement}{ListElement} - Defines a data item in a \l {QtQml2::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 \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 7163baa81950da568782c27c0f398ced94c1ac9e..0a4d276cb8895c375de9c659bee91e60397f8eb4 100644 --- a/src/quick/doc/src/qtquick.qdoc +++ b/src/quick/doc/src/qtquick.qdoc @@ -125,7 +125,7 @@ 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{QtQuick.Dialogs 1}{Dialogs} - contains types for creating and + \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 diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 58e1612e1993c96f58f0b31ec61badfe2dc95426..110e14d26628df97fe539ad273ca83342467bdd1 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. diff --git a/src/quick/items/qquickpositioners.cpp b/src/quick/items/qquickpositioners.cpp index 789d2e62aa40d02944e3f1e500d0e97fe430866f..b07a38cdafbf6c981ee02a6c2e1956042f764178 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 102066704baa74dd2609d976142aabf784885723..f39a15070c1fb341e6ef839d47b1ad889c76311f 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 bd0bb2348e08ba8883d1b765e56904e61fcbb2c2..9debfe35b394624c4b111cff322b5ceb8c0c9ee3 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 4a34adabe8921b533c6bf44c9e121af3358a02ad..7137bb165e4237dedc7cfd8564fd83f7cabdaa51 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); @@ -2969,7 +2971,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 +2981,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 @@ -2996,6 +2998,31 @@ QColor QQuickWindow::color() const return d_func()->clearColor; } +/*! + \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 diff --git a/src/quick/items/qquickwindow.h b/src/quick/items/qquickwindow.h index fc148aabe6893000fa55bd3caa32cf478b8be456..a0bc8323347a9617c0b388c9b8d5ca3e99d7bffb 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 9e3251b240f622131c22d30715b10865f5d2e0b4..2465629778356203a2ed0c7887b2d19535242875 100644 --- a/src/quick/items/qquickwindow_p.h +++ b/src/quick/items/qquickwindow_p.h @@ -219,6 +219,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/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp index 1c7f9cd800f5317c7e1e1a20107a962fa864d39d..c47250662b268752e3b21e58c62cf41c8940dffc 100644 --- a/src/quick/scenegraph/qsgcontext.cpp +++ b/src/quick/scenegraph/qsgcontext.cpp @@ -54,6 +54,7 @@ #include <QGuiApplication> #include <QOpenGLContext> +#include <QQuickWindow> #include <QtGui/qopenglframebufferobject.h> #include <private/qqmlglobal_p.h> @@ -396,6 +397,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; }