diff options
Diffstat (limited to 'examples')
251 files changed, 1954 insertions, 947 deletions
diff --git a/examples/qml/doc/src/qml-extending.qdoc b/examples/qml/doc/src/qml-extending.qdoc index 03df998823..5d92f0a51c 100644 --- a/examples/qml/doc/src/qml-extending.qdoc +++ b/examples/qml/doc/src/qml-extending.qdoc @@ -240,6 +240,12 @@ This example builds on: \brief Attached Properties. \ingroup qmlextendingexamples +This example demonstrates how to create custom +\l {Attached Properties and Attached Signal Handlers} {attached properties}. +For a more in-depth description on how one can create attached properties, +see \l {Providing Attached Properties}. + + This example builds on: \list \li \l {Extending QML - Grouped Properties Example} diff --git a/examples/qml/dynamicscene/dynamicscene.qml b/examples/qml/dynamicscene/dynamicscene.qml index cec8c803e8..62795703c5 100644 --- a/examples/qml/dynamicscene/dynamicscene.qml +++ b/examples/qml/dynamicscene/dynamicscene.qml @@ -210,7 +210,7 @@ Item { selectByMouse: true wrapMode: TextEdit.WordWrap - text: "import QtQuick 2.0\nImage {\n id: smile\n x: 360 * Math.random()\n y: 40 * Math.random() \n source: 'images/face-smile.png'\n NumberAnimation on opacity { \n to: 0; duration: 1500\n }\n Component.onCompleted: smile.destroy(1500);\n}" + text: "import QtQuick\nImage {\n id: smile\n x: 360 * Math.random()\n y: 40 * Math.random() \n source: 'images/face-smile.png'\n NumberAnimation on opacity { \n to: 0; duration: 1500\n }\n Component.onCompleted: smile.destroy(1500);\n}" } } } diff --git a/examples/qml/locale/locale.qml b/examples/qml/locale/locale.qml index 5ef0c58fc1..35875a3177 100644 --- a/examples/qml/locale/locale.qml +++ b/examples/qml/locale/locale.qml @@ -1,13 +1,26 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Rectangle { id: root width: 320 height: 480 color: "lightgray" + property list<string> locales: ([ + "en_US", + "en_GB", + "fi_FI", + "de_DE", + "ar_SA", + "hi_IN", + "zh_CN", + "th_TH", + "fr_FR", + "nb_NO", + "sv_SE" + ]) component LocaleDelegate: Text { required property var modelData @@ -23,7 +36,7 @@ Rectangle { } } - property string locale: (view.currentItem as LocaleDelegate).locale + property string locale: view.currentIndex === -1 ? "en_US" : root.locales[view.currentIndex] Text { id: title @@ -43,19 +56,7 @@ Rectangle { clip: true focus: true anchors.fill: parent - model: [ - "en_US", - "en_GB", - "fi_FI", - "de_DE", - "ar_SA", - "hi_IN", - "zh_CN", - "th_TH", - "fr_FR", - "nb_NO", - "sv_SE" - ] + model: root.locales delegate: LocaleDelegate {} highlight: Rectangle { diff --git a/examples/qml/networkaccessmanagerfactory/view.qml b/examples/qml/networkaccessmanagerfactory/view.qml index 6b8593df00..f3c845fabd 100644 --- a/examples/qml/networkaccessmanagerfactory/view.qml +++ b/examples/qml/networkaccessmanagerfactory/view.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Image { width: 200 diff --git a/examples/qml/qml-i18n/qml-i18n.qml b/examples/qml/qml-i18n/qml-i18n.qml index 94de1fb3b3..8d414348dd 100644 --- a/examples/qml/qml-i18n/qml-i18n.qml +++ b/examples/qml/qml-i18n/qml-i18n.qml @@ -1,8 +1,8 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.12 -import QtQuick.Window 2.12 +import QtQuick +import QtQuick.Window Window { visible: true diff --git a/examples/qml/qmlextensionplugins/imports/TimeExample/Clock.qml b/examples/qml/qmlextensionplugins/imports/TimeExample/Clock.qml index e74f99c20c..b071e2e031 100644 --- a/examples/qml/qmlextensionplugins/imports/TimeExample/Clock.qml +++ b/examples/qml/qmlextensionplugins/imports/TimeExample/Clock.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Rectangle { id: clock diff --git a/examples/qml/qmlextensionplugins/plugins.qml b/examples/qml/qmlextensionplugins/plugins.qml index 322f9590ed..55e8903400 100644 --- a/examples/qml/qmlextensionplugins/plugins.qml +++ b/examples/qml/qmlextensionplugins/plugins.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause //![0] -import TimeExample 1.0 // import types from the plugin +import TimeExample // import types from the plugin Clock { // this class is defined in QML (imports/TimeExample/Clock.qml) diff --git a/examples/qml/referenceexamples/adding/example.qml b/examples/qml/referenceexamples/adding/example.qml index 2e3a40e2ac..068352bc35 100644 --- a/examples/qml/referenceexamples/adding/example.qml +++ b/examples/qml/referenceexamples/adding/example.qml @@ -2,7 +2,7 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause // ![0] -import People 1.0 +import People Person { name: "Bob Jones" diff --git a/examples/qml/referenceexamples/attached/example.qml b/examples/qml/referenceexamples/attached/example.qml index 7b2c2cbf86..a4e675fe51 100644 --- a/examples/qml/referenceexamples/attached/example.qml +++ b/examples/qml/referenceexamples/attached/example.qml @@ -1,8 +1,8 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import People 1.0 -import QtQuick 2.0 // For QColor +import People +import QtQuick // For QColor //! [begin] BirthdayParty { diff --git a/examples/qml/referenceexamples/binding/example.qml b/examples/qml/referenceexamples/binding/example.qml index 92b5cbbc7a..262d667903 100644 --- a/examples/qml/referenceexamples/binding/example.qml +++ b/examples/qml/referenceexamples/binding/example.qml @@ -1,8 +1,8 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import People 1.0 -import QtQuick 2.0 // For QColor +import People +import QtQuick // For QColor // ![0] BirthdayParty { diff --git a/examples/qml/referenceexamples/coercion/example.qml b/examples/qml/referenceexamples/coercion/example.qml index fd48ed5bc8..99469bec57 100644 --- a/examples/qml/referenceexamples/coercion/example.qml +++ b/examples/qml/referenceexamples/coercion/example.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import People 1.0 +import People // ![0] BirthdayParty { diff --git a/examples/qml/referenceexamples/default/example.qml b/examples/qml/referenceexamples/default/example.qml index 4b23836860..addc74dfb5 100644 --- a/examples/qml/referenceexamples/default/example.qml +++ b/examples/qml/referenceexamples/default/example.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import People 1.0 +import People // ![0] BirthdayParty { diff --git a/examples/qml/referenceexamples/extended/example.qml b/examples/qml/referenceexamples/extended/example.qml index 8a628de26a..8a0b3193d8 100644 --- a/examples/qml/referenceexamples/extended/example.qml +++ b/examples/qml/referenceexamples/extended/example.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import People 1.0 +import People // ![0] QLineEdit { diff --git a/examples/qml/referenceexamples/grouped/example.qml b/examples/qml/referenceexamples/grouped/example.qml index 95f5bc1ebe..31d122e647 100644 --- a/examples/qml/referenceexamples/grouped/example.qml +++ b/examples/qml/referenceexamples/grouped/example.qml @@ -1,8 +1,8 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import People 1.0 -import QtQuick 2.0 // For QColor +import People +import QtQuick // For QColor // ![0] BirthdayParty { diff --git a/examples/qml/referenceexamples/methods/example.qml b/examples/qml/referenceexamples/methods/example.qml index 295a14c498..41d053edd2 100644 --- a/examples/qml/referenceexamples/methods/example.qml +++ b/examples/qml/referenceexamples/methods/example.qml @@ -2,8 +2,8 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause // ![0] -import QtQuick 2.0 -import People 1.0 +import QtQuick +import People BirthdayParty { host: Person { diff --git a/examples/qml/referenceexamples/properties/example.qml b/examples/qml/referenceexamples/properties/example.qml index a4d9a1e532..52fb3344f0 100644 --- a/examples/qml/referenceexamples/properties/example.qml +++ b/examples/qml/referenceexamples/properties/example.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import People 1.0 +import People // ![0] BirthdayParty { diff --git a/examples/qml/referenceexamples/signal/example.qml b/examples/qml/referenceexamples/signal/example.qml index feacf5d8bf..c35db2fe46 100644 --- a/examples/qml/referenceexamples/signal/example.qml +++ b/examples/qml/referenceexamples/signal/example.qml @@ -1,8 +1,8 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import People 1.0 -import QtQuick 2.0 // For QColor +import People +import QtQuick // For QColor BirthdayParty { // ![0] diff --git a/examples/qml/referenceexamples/valuesource/example.qml b/examples/qml/referenceexamples/valuesource/example.qml index 4166cda1f6..b6efe211c1 100644 --- a/examples/qml/referenceexamples/valuesource/example.qml +++ b/examples/qml/referenceexamples/valuesource/example.qml @@ -1,8 +1,8 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import People 1.0 -import QtQuick 2.0 // For QColor +import People +import QtQuick // For QColor // ![0] BirthdayParty { diff --git a/examples/qml/tutorials/extending-qml/chapter1-basics/CMakeLists.txt b/examples/qml/tutorials/extending-qml/chapter1-basics/CMakeLists.txt index 4fdc3a749b..a5cc93c6f3 100644 --- a/examples/qml/tutorials/extending-qml/chapter1-basics/CMakeLists.txt +++ b/examples/qml/tutorials/extending-qml/chapter1-basics/CMakeLists.txt @@ -33,6 +33,7 @@ qt_add_qml_module(chapter1-basics VERSION 1.0 QML_FILES app.qml NO_RESOURCE_TARGET_PATH + DEPENDENCIES QtQuick ) #![0] install(TARGETS chapter1-basics diff --git a/examples/qml/tutorials/extending-qml/chapter1-basics/app.qml b/examples/qml/tutorials/extending-qml/chapter1-basics/app.qml index 2e24522bb5..ed89ce97c4 100644 --- a/examples/qml/tutorials/extending-qml/chapter1-basics/app.qml +++ b/examples/qml/tutorials/extending-qml/chapter1-basics/app.qml @@ -1,8 +1,8 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause //![0] -import Charts 1.0 -import QtQuick 2.0 +import Charts +import QtQuick Item { width: 300; height: 200 diff --git a/examples/qml/tutorials/extending-qml/chapter1-basics/piechart.h b/examples/qml/tutorials/extending-qml/chapter1-basics/piechart.h index 6b39295e8d..a438cafbfb 100644 --- a/examples/qml/tutorials/extending-qml/chapter1-basics/piechart.h +++ b/examples/qml/tutorials/extending-qml/chapter1-basics/piechart.h @@ -10,8 +10,8 @@ class PieChart : public QQuickPaintedItem { Q_OBJECT - Q_PROPERTY(QString name READ name WRITE setName) - Q_PROPERTY(QColor color READ color WRITE setColor) + Q_PROPERTY(QString name READ name WRITE setName FINAL) + Q_PROPERTY(QColor color READ color WRITE setColor FINAL) QML_ELEMENT public: diff --git a/examples/qml/tutorials/extending-qml/chapter2-methods/CMakeLists.txt b/examples/qml/tutorials/extending-qml/chapter2-methods/CMakeLists.txt index f6eee234bc..95f4f19315 100644 --- a/examples/qml/tutorials/extending-qml/chapter2-methods/CMakeLists.txt +++ b/examples/qml/tutorials/extending-qml/chapter2-methods/CMakeLists.txt @@ -33,6 +33,7 @@ qt_add_qml_module(chapter2-methods VERSION 1.0 QML_FILES app.qml NO_RESOURCE_TARGET_PATH + DEPENDENCIES QtQuick ) install(TARGETS chapter2-methods diff --git a/examples/qml/tutorials/extending-qml/chapter2-methods/app.qml b/examples/qml/tutorials/extending-qml/chapter2-methods/app.qml index 2204796772..56597c3f42 100644 --- a/examples/qml/tutorials/extending-qml/chapter2-methods/app.qml +++ b/examples/qml/tutorials/extending-qml/chapter2-methods/app.qml @@ -1,8 +1,8 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause //![0] -import Charts 1.0 -import QtQuick 2.0 +import Charts +import QtQuick Item { width: 300; height: 200 diff --git a/examples/qml/tutorials/extending-qml/chapter2-methods/piechart.h b/examples/qml/tutorials/extending-qml/chapter2-methods/piechart.h index 07eb48ceda..d1eb5f1359 100644 --- a/examples/qml/tutorials/extending-qml/chapter2-methods/piechart.h +++ b/examples/qml/tutorials/extending-qml/chapter2-methods/piechart.h @@ -11,8 +11,8 @@ class PieChart : public QQuickPaintedItem { //![0] Q_OBJECT - Q_PROPERTY(QString name READ name WRITE setName) - Q_PROPERTY(QColor color READ color WRITE setColor) + Q_PROPERTY(QString name READ name WRITE setName FINAL) + Q_PROPERTY(QColor color READ color WRITE setColor FINAL) QML_ELEMENT //![1] public: diff --git a/examples/qml/tutorials/extending-qml/chapter3-bindings/CMakeLists.txt b/examples/qml/tutorials/extending-qml/chapter3-bindings/CMakeLists.txt index 585821669b..502cc8f3ce 100644 --- a/examples/qml/tutorials/extending-qml/chapter3-bindings/CMakeLists.txt +++ b/examples/qml/tutorials/extending-qml/chapter3-bindings/CMakeLists.txt @@ -33,6 +33,7 @@ qt_add_qml_module(chapter3-bindings VERSION 1.0 QML_FILES app.qml NO_RESOURCE_TARGET_PATH + DEPENDENCIES QtQuick ) install(TARGETS chapter3-bindings diff --git a/examples/qml/tutorials/extending-qml/chapter3-bindings/app.qml b/examples/qml/tutorials/extending-qml/chapter3-bindings/app.qml index 2262941170..d29eaf4b9f 100644 --- a/examples/qml/tutorials/extending-qml/chapter3-bindings/app.qml +++ b/examples/qml/tutorials/extending-qml/chapter3-bindings/app.qml @@ -1,8 +1,8 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause //![0] -import Charts 1.0 -import QtQuick 2.0 +import Charts +import QtQuick Item { width: 300; height: 200 diff --git a/examples/qml/tutorials/extending-qml/chapter3-bindings/piechart.h b/examples/qml/tutorials/extending-qml/chapter3-bindings/piechart.h index a6be1b559c..449d0f80a8 100644 --- a/examples/qml/tutorials/extending-qml/chapter3-bindings/piechart.h +++ b/examples/qml/tutorials/extending-qml/chapter3-bindings/piechart.h @@ -11,11 +11,11 @@ class PieChart : public QQuickPaintedItem { //![0] Q_OBJECT - Q_PROPERTY(QString name READ name WRITE setName) + Q_PROPERTY(QString name READ name WRITE setName FINAL) QML_ELEMENT //![1] - Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) + Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged FINAL) public: //![1] diff --git a/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/CMakeLists.txt b/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/CMakeLists.txt index eeddbcfc14..c7263d103b 100644 --- a/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/CMakeLists.txt +++ b/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/CMakeLists.txt @@ -34,6 +34,7 @@ qt_add_qml_module(chapter4-customPropertyTypes VERSION 1.0 QML_FILES app.qml NO_RESOURCE_TARGET_PATH + DEPENDENCIES QtQuick ) #![1] install(TARGETS chapter4-customPropertyTypes diff --git a/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/app.qml b/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/app.qml index 34d8d4196d..2edcda568e 100644 --- a/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/app.qml +++ b/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/app.qml @@ -1,8 +1,8 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause //![0] -import Charts 1.0 -import QtQuick 2.0 +import Charts +import QtQuick Item { width: 300; height: 200 diff --git a/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/piechart.h b/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/piechart.h index e684d9c7e8..0c4088435f 100644 --- a/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/piechart.h +++ b/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/piechart.h @@ -11,9 +11,9 @@ class PieSlice; class PieChart : public QQuickItem { Q_OBJECT - Q_PROPERTY(PieSlice* pieSlice READ pieSlice WRITE setPieSlice) + Q_PROPERTY(PieSlice* pieSlice READ pieSlice WRITE setPieSlice FINAL) //![0] - Q_PROPERTY(QString name READ name WRITE setName) + Q_PROPERTY(QString name READ name WRITE setName FINAL) Q_MOC_INCLUDE("pieslice.h") QML_ELEMENT //![1] diff --git a/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/pieslice.h b/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/pieslice.h index d291272eaf..74c6149e85 100644 --- a/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/pieslice.h +++ b/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/pieslice.h @@ -10,7 +10,7 @@ class PieSlice : public QQuickPaintedItem { Q_OBJECT - Q_PROPERTY(QColor color READ color WRITE setColor) + Q_PROPERTY(QColor color READ color WRITE setColor FINAL) QML_ELEMENT public: diff --git a/examples/qml/tutorials/extending-qml/chapter5-listproperties/CMakeLists.txt b/examples/qml/tutorials/extending-qml/chapter5-listproperties/CMakeLists.txt index e5a843efb4..210d33115b 100644 --- a/examples/qml/tutorials/extending-qml/chapter5-listproperties/CMakeLists.txt +++ b/examples/qml/tutorials/extending-qml/chapter5-listproperties/CMakeLists.txt @@ -34,6 +34,7 @@ qt_add_qml_module(chapter5-listproperties VERSION 1.0 QML_FILES app.qml NO_RESOURCE_TARGET_PATH + DEPENDENCIES QtQuick ) install(TARGETS chapter5-listproperties diff --git a/examples/qml/tutorials/extending-qml/chapter5-listproperties/app.qml b/examples/qml/tutorials/extending-qml/chapter5-listproperties/app.qml index cd9b7918fc..9e200a9b60 100644 --- a/examples/qml/tutorials/extending-qml/chapter5-listproperties/app.qml +++ b/examples/qml/tutorials/extending-qml/chapter5-listproperties/app.qml @@ -1,8 +1,8 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause //![0] -import Charts 1.0 -import QtQuick 2.0 +import Charts +import QtQuick Item { width: 300; height: 200 diff --git a/examples/qml/tutorials/extending-qml/chapter5-listproperties/piechart.h b/examples/qml/tutorials/extending-qml/chapter5-listproperties/piechart.h index 749c12d622..05f0f1ddad 100644 --- a/examples/qml/tutorials/extending-qml/chapter5-listproperties/piechart.h +++ b/examples/qml/tutorials/extending-qml/chapter5-listproperties/piechart.h @@ -11,9 +11,9 @@ class PieSlice; class PieChart : public QQuickItem { Q_OBJECT - Q_PROPERTY(QQmlListProperty<PieSlice> slices READ slices) + Q_PROPERTY(QQmlListProperty<PieSlice> slices READ slices FINAL) //![0] - Q_PROPERTY(QString name READ name WRITE setName) + Q_PROPERTY(QString name READ name WRITE setName FINAL) QML_ELEMENT //![1] diff --git a/examples/qml/tutorials/extending-qml/chapter5-listproperties/pieslice.h b/examples/qml/tutorials/extending-qml/chapter5-listproperties/pieslice.h index 318234f92b..14efaffcc8 100644 --- a/examples/qml/tutorials/extending-qml/chapter5-listproperties/pieslice.h +++ b/examples/qml/tutorials/extending-qml/chapter5-listproperties/pieslice.h @@ -10,9 +10,9 @@ class PieSlice : public QQuickPaintedItem { Q_OBJECT - Q_PROPERTY(QColor color READ color WRITE setColor) - Q_PROPERTY(int fromAngle READ fromAngle WRITE setFromAngle) - Q_PROPERTY(int angleSpan READ angleSpan WRITE setAngleSpan) + Q_PROPERTY(QColor color READ color WRITE setColor FINAL) + Q_PROPERTY(int fromAngle READ fromAngle WRITE setFromAngle FINAL) + Q_PROPERTY(int angleSpan READ angleSpan WRITE setAngleSpan FINAL) QML_ELEMENT //![0] diff --git a/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/CMakeLists.txt b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/CMakeLists.txt index f76011e2f8..da4c649864 100644 --- a/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/CMakeLists.txt +++ b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/CMakeLists.txt @@ -2,6 +2,7 @@ qt6_add_qml_module(chartsplugin VERSION 1.0 URI "Charts" PLUGIN_TARGET chartsplugin + DEPENDENCIES QtQuick ) target_sources(chartsplugin PRIVATE @@ -45,3 +46,5 @@ install(TARGETS chartsplugin BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" ) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qmldir + DESTINATION "${INSTALL_EXAMPLEDIR}") diff --git a/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/piechart.h b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/piechart.h index 2c50be16cf..6c771e9814 100644 --- a/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/piechart.h +++ b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/piechart.h @@ -10,8 +10,8 @@ class PieSlice; class PieChart : public QQuickItem { Q_OBJECT - Q_PROPERTY(QQmlListProperty<PieSlice> slices READ slices) - Q_PROPERTY(QString name READ name WRITE setName) + Q_PROPERTY(QQmlListProperty<PieSlice> slices READ slices FINAL) + Q_PROPERTY(QString name READ name WRITE setName FINAL) QML_ELEMENT public: diff --git a/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/pieslice.h b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/pieslice.h index a8987f00fc..b07773c29f 100644 --- a/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/pieslice.h +++ b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/pieslice.h @@ -9,9 +9,9 @@ class PieSlice : public QQuickPaintedItem { Q_OBJECT - Q_PROPERTY(QColor color READ color WRITE setColor) - Q_PROPERTY(int fromAngle READ fromAngle WRITE setFromAngle) - Q_PROPERTY(int angleSpan READ angleSpan WRITE setAngleSpan) + Q_PROPERTY(QColor color READ color WRITE setColor FINAL) + Q_PROPERTY(int fromAngle READ fromAngle WRITE setFromAngle FINAL) + Q_PROPERTY(int angleSpan READ angleSpan WRITE setAngleSpan FINAL) QML_ELEMENT public: diff --git a/examples/qml/tutorials/extending-qml/chapter6-plugins/app.qml b/examples/qml/tutorials/extending-qml/chapter6-plugins/app.qml index fe1d2e2199..1d1cb74176 100644 --- a/examples/qml/tutorials/extending-qml/chapter6-plugins/app.qml +++ b/examples/qml/tutorials/extending-qml/chapter6-plugins/app.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 -import Charts 1.0 +import QtQuick +import Charts Item { width: 300; height: 200 diff --git a/examples/qmltest/qmltest/tst_basic.qml b/examples/qmltest/qmltest/tst_basic.qml index 7ea69b1f76..e3ce172beb 100644 --- a/examples/qmltest/qmltest/tst_basic.qml +++ b/examples/qmltest/qmltest/tst_basic.qml @@ -1,8 +1,8 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.4 -import QtTest 1.1 +import QtQuick +import QtTest TestCase { name: "BasicTests" diff --git a/examples/qmltest/qmltest/tst_item.qml b/examples/qmltest/qmltest/tst_item.qml index fbe2a28f49..047bd254dd 100644 --- a/examples/qmltest/qmltest/tst_item.qml +++ b/examples/qmltest/qmltest/tst_item.qml @@ -1,8 +1,8 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.4 -import QtTest 1.1 +import QtQuick +import QtTest Rectangle { id: foo diff --git a/examples/quick/animation/animation.qml b/examples/quick/animation/animation.qml index 1c21445d08..75e6b86b29 100644 --- a/examples/quick/animation/animation.qml +++ b/examples/quick/animation/animation.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick import shared as Examples Item { diff --git a/examples/quick/animation/basics/animators.qml b/examples/quick/animation/basics/animators.qml index 9927acf9c5..80765d21d4 100644 --- a/examples/quick/animation/basics/animators.qml +++ b/examples/quick/animation/basics/animators.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.2 +import QtQuick Item { id: window diff --git a/examples/quick/animation/basics/color-animation.qml b/examples/quick/animation/basics/color-animation.qml index 80c627b02f..6427e06ad2 100644 --- a/examples/quick/animation/basics/color-animation.qml +++ b/examples/quick/animation/basics/color-animation.qml @@ -1,8 +1,8 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 -import QtQuick.Particles 2.0 +import QtQuick +import QtQuick.Particles Item { id: window diff --git a/examples/quick/animation/basics/property-animation.qml b/examples/quick/animation/basics/property-animation.qml index 0e2f3980ef..cd9b8277f5 100644 --- a/examples/quick/animation/basics/property-animation.qml +++ b/examples/quick/animation/basics/property-animation.qml @@ -1,8 +1,8 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQml 2.0 -import QtQuick 2.0 +import QtQml +import QtQuick Item { id: window diff --git a/examples/quick/animation/behaviors/FocusRect.qml b/examples/quick/animation/behaviors/FocusRect.qml index acd16b6219..9841162e57 100644 --- a/examples/quick/animation/behaviors/FocusRect.qml +++ b/examples/quick/animation/behaviors/FocusRect.qml @@ -1,7 +1,7 @@ // Copyright (C) 2019 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Rectangle { id: focusRect diff --git a/examples/quick/animation/behaviors/SideRect.qml b/examples/quick/animation/behaviors/SideRect.qml index d961fe149e..5230e5a406 100644 --- a/examples/quick/animation/behaviors/SideRect.qml +++ b/examples/quick/animation/behaviors/SideRect.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Rectangle { id: myRect diff --git a/examples/quick/animation/behaviors/behavior-example.qml b/examples/quick/animation/behaviors/behavior-example.qml index a92212350d..c994ec18d9 100644 --- a/examples/quick/animation/behaviors/behavior-example.qml +++ b/examples/quick/animation/behaviors/behavior-example.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Rectangle { width: 320; height: 480 diff --git a/examples/quick/animation/behaviors/tvtennis.qml b/examples/quick/animation/behaviors/tvtennis.qml index 9774b26d17..0b8ba15ad7 100644 --- a/examples/quick/animation/behaviors/tvtennis.qml +++ b/examples/quick/animation/behaviors/tvtennis.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Rectangle { id: page diff --git a/examples/quick/animation/behaviors/wigglytext.qml b/examples/quick/animation/behaviors/wigglytext.qml index c03cedafee..712078866d 100644 --- a/examples/quick/animation/behaviors/wigglytext.qml +++ b/examples/quick/animation/behaviors/wigglytext.qml @@ -1,8 +1,8 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQml 2.0 -import QtQuick 2.0 +import QtQml +import QtQuick Rectangle { id: container diff --git a/examples/quick/animation/easing/easing.qml b/examples/quick/animation/easing/easing.qml index ad735c77b7..26272f3c0f 100644 --- a/examples/quick/animation/easing/easing.qml +++ b/examples/quick/animation/easing/easing.qml @@ -1,9 +1,9 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQml 2.15 -import QtQml.Models 2.15 -import QtQuick 2.0 +import QtQml +import QtQml.Models +import QtQuick Rectangle { id: window diff --git a/examples/quick/animation/pathanimation/pathanimation.qml b/examples/quick/animation/pathanimation/pathanimation.qml index 96202fc04e..1f3577a47c 100644 --- a/examples/quick/animation/pathanimation/pathanimation.qml +++ b/examples/quick/animation/pathanimation/pathanimation.qml @@ -1,8 +1,8 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQml 2.0 -import QtQuick 2.0 +import QtQml +import QtQuick Rectangle { id: window diff --git a/examples/quick/animation/pathinterpolator/pathinterpolator.qml b/examples/quick/animation/pathinterpolator/pathinterpolator.qml index 3051f06728..a035e9ba0c 100644 --- a/examples/quick/animation/pathinterpolator/pathinterpolator.qml +++ b/examples/quick/animation/pathinterpolator/pathinterpolator.qml @@ -1,8 +1,8 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQml 2.0 -import QtQuick 2.0 +import QtQml +import QtQuick Rectangle { id: window diff --git a/examples/quick/animation/states/states.qml b/examples/quick/animation/states/states.qml index 7145c9ed0b..78a8c0668b 100644 --- a/examples/quick/animation/states/states.qml +++ b/examples/quick/animation/states/states.qml @@ -1,8 +1,8 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQml 2.0 -import QtQuick 2.0 +import QtQml +import QtQuick Rectangle { id: page diff --git a/examples/quick/animation/states/transitions.qml b/examples/quick/animation/states/transitions.qml index b8031cf0e0..a318bc82b0 100644 --- a/examples/quick/animation/states/transitions.qml +++ b/examples/quick/animation/states/transitions.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick /* This is exactly the same as states.qml, except that we have appended diff --git a/examples/quick/customitems/dialcontrol/Dial.qml b/examples/quick/customitems/dialcontrol/Dial.qml index f69b93ce97..7e3b8cbd87 100644 --- a/examples/quick/customitems/dialcontrol/Dial.qml +++ b/examples/quick/customitems/dialcontrol/Dial.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Item { id: root diff --git a/examples/quick/customitems/dialcontrol/QuitButton.qml b/examples/quick/customitems/dialcontrol/QuitButton.qml index fd6d7899e2..af362b6ddf 100644 --- a/examples/quick/customitems/dialcontrol/QuitButton.qml +++ b/examples/quick/customitems/dialcontrol/QuitButton.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Image { source: "quit.png" scale: quitMouse.pressed ? 0.8 : 1.0 diff --git a/examples/quick/customitems/dialcontrol/dialcontrol.qml b/examples/quick/customitems/dialcontrol/dialcontrol.qml index ec9fe0ee5c..d30f66fa2c 100644 --- a/examples/quick/customitems/dialcontrol/dialcontrol.qml +++ b/examples/quick/customitems/dialcontrol/dialcontrol.qml @@ -2,8 +2,8 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause //! [imports] -import QtQuick 2.2 -import QtQuick.Window 2.1 +import QtQuick +import QtQuick.Window //! [imports] //! [0] diff --git a/examples/quick/customitems/maskedmousearea/maskedmousearea.qml b/examples/quick/customitems/maskedmousearea/maskedmousearea.qml index 521da6c723..df8de3dcb8 100644 --- a/examples/quick/customitems/maskedmousearea/maskedmousearea.qml +++ b/examples/quick/customitems/maskedmousearea/maskedmousearea.qml @@ -1,8 +1,8 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 -import Example 1.0 +import QtQuick +import Example Rectangle { height: 480 diff --git a/examples/quick/customitems/painteditem/textballoons.qml b/examples/quick/customitems/painteditem/textballoons.qml index 156e63c015..d363093d95 100644 --- a/examples/quick/customitems/painteditem/textballoons.qml +++ b/examples/quick/customitems/painteditem/textballoons.qml @@ -1,8 +1,8 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 -import TextBalloon 1.0 +import QtQuick +import TextBalloon Item { height: 480 diff --git a/examples/quick/customitems/progressbar/content/ProgressBar.qml b/examples/quick/customitems/progressbar/content/ProgressBar.qml index f1a343fb45..f97ab90709 100644 --- a/examples/quick/customitems/progressbar/content/ProgressBar.qml +++ b/examples/quick/customitems/progressbar/content/ProgressBar.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Item { id: progressbar diff --git a/examples/quick/customitems/progressbar/main.qml b/examples/quick/customitems/progressbar/main.qml index 441d82bc45..7b281aeb90 100644 --- a/examples/quick/customitems/progressbar/main.qml +++ b/examples/quick/customitems/progressbar/main.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick import "content" Rectangle { diff --git a/examples/quick/customitems/scrollbar/ScrollBar.qml b/examples/quick/customitems/scrollbar/ScrollBar.qml index b3cba5b6d8..1df14ddba8 100644 --- a/examples/quick/customitems/scrollbar/ScrollBar.qml +++ b/examples/quick/customitems/scrollbar/ScrollBar.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Item { id: scrollBar diff --git a/examples/quick/customitems/scrollbar/main.qml b/examples/quick/customitems/scrollbar/main.qml index 4a4378ff42..61b6453c03 100644 --- a/examples/quick/customitems/scrollbar/main.qml +++ b/examples/quick/customitems/scrollbar/main.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Rectangle { width: 640 diff --git a/examples/quick/customitems/searchbox/SearchBox.qml b/examples/quick/customitems/searchbox/SearchBox.qml index 2d47d80ea2..205e691508 100644 --- a/examples/quick/customitems/searchbox/SearchBox.qml +++ b/examples/quick/customitems/searchbox/SearchBox.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick FocusScope { id: focusScope diff --git a/examples/quick/customitems/searchbox/main.qml b/examples/quick/customitems/searchbox/main.qml index f5b7634c90..f250c4067d 100644 --- a/examples/quick/customitems/searchbox/main.qml +++ b/examples/quick/customitems/searchbox/main.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Rectangle { id: page diff --git a/examples/quick/customitems/slideswitch/content/Switch.qml b/examples/quick/customitems/slideswitch/content/Switch.qml index 9736d37b3f..38beefb8c4 100644 --- a/examples/quick/customitems/slideswitch/content/Switch.qml +++ b/examples/quick/customitems/slideswitch/content/Switch.qml @@ -2,7 +2,7 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause //![0] -import QtQuick 2.0 +import QtQuick Item { id: toggleswitch diff --git a/examples/quick/customitems/slideswitch/slideswitch.qml b/examples/quick/customitems/slideswitch/slideswitch.qml index 75cc3c3aa9..430c46c6dd 100644 --- a/examples/quick/customitems/slideswitch/slideswitch.qml +++ b/examples/quick/customitems/slideswitch/slideswitch.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick import "content" Rectangle { diff --git a/examples/quick/customitems/spinner/content/Spinner.qml b/examples/quick/customitems/spinner/content/Spinner.qml index f698078774..c5f2a2b4ed 100644 --- a/examples/quick/customitems/spinner/content/Spinner.qml +++ b/examples/quick/customitems/spinner/content/Spinner.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Image { property alias model: view.model diff --git a/examples/quick/customitems/spinner/main.qml b/examples/quick/customitems/spinner/main.qml index 8da8db749c..e6b674fc53 100644 --- a/examples/quick/customitems/spinner/main.qml +++ b/examples/quick/customitems/spinner/main.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick import "content" Rectangle { diff --git a/examples/quick/customitems/tabwidget/TabWidget.qml b/examples/quick/customitems/tabwidget/TabWidget.qml index 6810a4e200..f031cd8beb 100644 --- a/examples/quick/customitems/tabwidget/TabWidget.qml +++ b/examples/quick/customitems/tabwidget/TabWidget.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Item { id: tabWidget diff --git a/examples/quick/customitems/tabwidget/main.qml b/examples/quick/customitems/tabwidget/main.qml index 9158e44da9..ef73847f66 100644 --- a/examples/quick/customitems/tabwidget/main.qml +++ b/examples/quick/customitems/tabwidget/main.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick TabWidget { id: tabs diff --git a/examples/quick/delegatechooser/delegatechooser.qml b/examples/quick/delegatechooser/delegatechooser.qml index cf45e3e1c9..9e7eff9fdc 100644 --- a/examples/quick/delegatechooser/delegatechooser.qml +++ b/examples/quick/delegatechooser/delegatechooser.qml @@ -1,10 +1,10 @@ // Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.12 -import QtQml.Models 2.12 -import QtQuick.Layouts 1.12 -import Qt.labs.qmlmodels 1.0 +import QtQuick +import QtQml.Models +import QtQuick.Layouts +import Qt.labs.qmlmodels import shared Rectangle { diff --git a/examples/quick/draganddrop/tiles/DragTile.qml b/examples/quick/draganddrop/tiles/DragTile.qml index 41813ecc19..c4d81a7662 100644 --- a/examples/quick/draganddrop/tiles/DragTile.qml +++ b/examples/quick/draganddrop/tiles/DragTile.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick //! [0] Item { diff --git a/examples/quick/draganddrop/tiles/DropTile.qml b/examples/quick/draganddrop/tiles/DropTile.qml index 0746992ce9..86fdbd86b3 100644 --- a/examples/quick/draganddrop/tiles/DropTile.qml +++ b/examples/quick/draganddrop/tiles/DropTile.qml @@ -1,14 +1,13 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick //! [0] DropArea { id: dragTarget property string colorKey - property alias dropProxy: dragTarget width: 64; height: 64 keys: [ colorKey ] @@ -17,16 +16,7 @@ DropArea { id: dropRectangle anchors.fill: parent - color: dragTarget.colorKey - - states: [ - State { - when: dragTarget.containsDrag - PropertyChanges { - dropRectangle.color: "grey" - } - } - ] + color: dragTarget.containsDrag ? "grey" : dragTarget.colorKey } } //! [0] diff --git a/examples/quick/draganddrop/tiles/tiles.qml b/examples/quick/draganddrop/tiles/tiles.qml index 542a2800af..62fb802972 100644 --- a/examples/quick/draganddrop/tiles/tiles.qml +++ b/examples/quick/draganddrop/tiles/tiles.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Rectangle { id: root diff --git a/examples/quick/draganddrop/views/Icon.qml b/examples/quick/draganddrop/views/Icon.qml index dcd5cb338d..ed5c6e51e5 100644 --- a/examples/quick/draganddrop/views/Icon.qml +++ b/examples/quick/draganddrop/views/Icon.qml @@ -1,7 +1,7 @@ // Copyright (C) 2019 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.14 +import QtQuick Rectangle { id: icon diff --git a/examples/quick/imageprovider/imageprovider-example.qml b/examples/quick/imageprovider/imageprovider-example.qml index bd3bb0f47e..5bd092bc2d 100644 --- a/examples/quick/imageprovider/imageprovider-example.qml +++ b/examples/quick/imageprovider/imageprovider-example.qml @@ -1,6 +1,6 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick import "ImageProviderCore" // import the plugin that registers the color image provider //![0] diff --git a/examples/quick/imageresponseprovider/imageresponseprovider-example.qml b/examples/quick/imageresponseprovider/imageresponseprovider-example.qml index 2767dbff1d..980e25fb5b 100644 --- a/examples/quick/imageresponseprovider/imageresponseprovider-example.qml +++ b/examples/quick/imageresponseprovider/imageresponseprovider-example.qml @@ -1,7 +1,7 @@ // Copyright (C) 2015 Canonical Limited and/or its subsidiary(-ies) // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick import "ImageResponseProviderCore" Column { diff --git a/examples/quick/models/stringlistmodel/view.qml b/examples/quick/models/stringlistmodel/view.qml index 134062cc9c..c94987a356 100644 --- a/examples/quick/models/stringlistmodel/view.qml +++ b/examples/quick/models/stringlistmodel/view.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick //![0] ListView { diff --git a/examples/quick/particles/affectors/GreyButton.qml b/examples/quick/particles/affectors/GreyButton.qml index 300d6981de..0d29246c2b 100644 --- a/examples/quick/particles/affectors/GreyButton.qml +++ b/examples/quick/particles/affectors/GreyButton.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Item { id: container diff --git a/examples/quick/particles/affectors/move.qml b/examples/quick/particles/affectors/move.qml index b9901ef3c9..447f5b0d32 100644 --- a/examples/quick/particles/affectors/move.qml +++ b/examples/quick/particles/affectors/move.qml @@ -1,8 +1,8 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 -import QtQuick.Particles 2.0 +import QtQuick +import QtQuick.Particles Rectangle { width: 360 diff --git a/examples/quick/particles/emitters/burstandpulse.qml b/examples/quick/particles/emitters/burstandpulse.qml index 8b2e637c70..ffc620e41b 100644 --- a/examples/quick/particles/emitters/burstandpulse.qml +++ b/examples/quick/particles/emitters/burstandpulse.qml @@ -1,8 +1,8 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 -import QtQuick.Particles 2.0 +import QtQuick +import QtQuick.Particles Rectangle { id: root diff --git a/examples/quick/particles/emitters/customemitter.qml b/examples/quick/particles/emitters/customemitter.qml index d7cd220f4a..5aba7d1b9f 100644 --- a/examples/quick/particles/emitters/customemitter.qml +++ b/examples/quick/particles/emitters/customemitter.qml @@ -1,8 +1,8 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 -import QtQuick.Particles 2.0 +import QtQuick +import QtQuick.Particles ParticleSystem { id: sys diff --git a/examples/quick/particles/emitters/emitmask.qml b/examples/quick/particles/emitters/emitmask.qml index 55ad34fd27..8a3e97f1d9 100644 --- a/examples/quick/particles/emitters/emitmask.qml +++ b/examples/quick/particles/emitters/emitmask.qml @@ -1,8 +1,8 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 -import QtQuick.Particles 2.0 +import QtQuick +import QtQuick.Particles Rectangle { color: "goldenrod" diff --git a/examples/quick/particles/emitters/maximumemitted.qml b/examples/quick/particles/emitters/maximumemitted.qml index 2bbd8a7c47..c5d33a9541 100644 --- a/examples/quick/particles/emitters/maximumemitted.qml +++ b/examples/quick/particles/emitters/maximumemitted.qml @@ -1,8 +1,8 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 -import QtQuick.Particles 2.0 +import QtQuick +import QtQuick.Particles Rectangle { color: "black" diff --git a/examples/quick/particles/emitters/shapeanddirection.qml b/examples/quick/particles/emitters/shapeanddirection.qml index 5ddd96a5de..190eb9cb60 100644 --- a/examples/quick/particles/emitters/shapeanddirection.qml +++ b/examples/quick/particles/emitters/shapeanddirection.qml @@ -1,8 +1,8 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 -import QtQuick.Particles 2.0 +import QtQuick +import QtQuick.Particles Rectangle { id: root diff --git a/examples/quick/particles/emitters/trailemitter.qml b/examples/quick/particles/emitters/trailemitter.qml index 893690061a..eb8f03ab3c 100644 --- a/examples/quick/particles/emitters/trailemitter.qml +++ b/examples/quick/particles/emitters/trailemitter.qml @@ -1,8 +1,8 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 -import QtQuick.Particles 2.0 +import QtQuick +import QtQuick.Particles Rectangle { id: root diff --git a/examples/quick/particles/emitters/velocityfrommotion.qml b/examples/quick/particles/emitters/velocityfrommotion.qml index 7fc908eb42..df8070e768 100644 --- a/examples/quick/particles/emitters/velocityfrommotion.qml +++ b/examples/quick/particles/emitters/velocityfrommotion.qml @@ -1,8 +1,8 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 -import QtQuick.Particles 2.0 +import QtQuick +import QtQuick.Particles Rectangle { diff --git a/examples/quick/pointerhandlers/components/FlashAnimation.qml b/examples/quick/pointerhandlers/components/FlashAnimation.qml index e369282470..bdbcaecdfa 100644 --- a/examples/quick/pointerhandlers/components/FlashAnimation.qml +++ b/examples/quick/pointerhandlers/components/FlashAnimation.qml @@ -6,15 +6,9 @@ import QtQuick SequentialAnimation { id: tapFlash running: false + loops: 3 PropertyAction { value: false } PauseAnimation { duration: 100 } PropertyAction { value: true } PauseAnimation { duration: 100 } - PropertyAction { value: false } - PauseAnimation { duration: 100 } - PropertyAction { value: true } - PauseAnimation { duration: 100 } - PropertyAction { value: false } - PauseAnimation { duration: 100 } - PropertyAction { value: true } } diff --git a/examples/quick/pointerhandlers/map.qml b/examples/quick/pointerhandlers/map.qml index 155aba6f42..082d9d26c3 100644 --- a/examples/quick/pointerhandlers/map.qml +++ b/examples/quick/pointerhandlers/map.qml @@ -73,8 +73,6 @@ Item { target: map minimumScale: 0.1 maximumScale: 10 - xAxis.enabled: false - yAxis.enabled: false onActiveChanged: if (!active) reRenderIfNecessary() grabPermissions: PinchHandler.TakeOverForbidden // don't allow takeover if pinch has started } diff --git a/examples/quick/pointerhandlers/pinchHandler.qml b/examples/quick/pointerhandlers/pinchHandler.qml index 41643fbaea..f8febc47ee 100644 --- a/examples/quick/pointerhandlers/pinchHandler.qml +++ b/examples/quick/pointerhandlers/pinchHandler.qml @@ -133,7 +133,7 @@ Rectangle { onGrabChanged: function (transition, point) { if (transition === 0x10) { // GrabExclusive console.log(point.id, "grabbed @", point.position) - Qt.createQmlObject("import QtQuick 2.0; Rectangle { opacity: 0.5; border.color: 'red'; radius: 8; width: radius * 2; height: radius * 2; " + + Qt.createQmlObject("import QtQuick; Rectangle { opacity: 0.5; border.color: 'red'; radius: 8; width: radius * 2; height: radius * 2; " + "x: " + (point.position.x - 8) + "; y: " + (point.position.y - 8) + "}", rect3, "touchpoint" + point.id); } diff --git a/examples/quick/pointerhandlers/sidebar.qml b/examples/quick/pointerhandlers/sidebar.qml index 187e535d92..55857cf733 100644 --- a/examples/quick/pointerhandlers/sidebar.qml +++ b/examples/quick/pointerhandlers/sidebar.qml @@ -10,69 +10,66 @@ Rectangle { height: 480 color: rootHover.hovered ? "#555" : "#444" - Component { - id: buttonsAndStuff - Column { - anchors.fill: parent - anchors.margins: 8 - spacing: 8 + component ButtonsAndStuff: Column { + anchors.fill: parent + anchors.margins: 8 + spacing: 8 + + CheckBox { + id: hoverBlockingCB + text: "Button hover is blocking" + } + + Rectangle { + objectName: "buttonWithMA" + width: parent.width + height: 30 + color: buttonMA.pressed ? "lightsteelblue" : "#999" + border.color: buttonMA.containsMouse ? "cyan" : "transparent" + + MouseArea { + id: buttonMA + objectName: "buttonMA" + hoverEnabled: true + cursorShape: Qt.UpArrowCursor + anchors.fill: parent + onClicked: console.log("clicked MA") + } + + Text { + anchors.centerIn: parent + text: "MouseArea" + } + } + + Rectangle { + objectName: "buttonWithHH" + width: parent.width + height: 30 + color: flash ? "#999" : "white" + border.color: buttonHH.hovered ? "cyan" : "transparent" + property bool flash: true + + HoverHandler { + id: buttonHH + objectName: "buttonHH" + acceptedDevices: PointerDevice.AllDevices + blocking: hoverBlockingCB.checked + cursorShape: tapHandler.pressed ? Qt.BusyCursor : Qt.PointingHandCursor + } - CheckBox { - id: hoverBlockingCB - text: "Button hover is blocking" + TapHandler { + id: tapHandler + onTapped: tapFlash.start() } - Rectangle { - objectName: "buttonWithMA" - width: parent.width - height: 30 - color: buttonMA.pressed ? "lightsteelblue" : "#999" - border.color: buttonMA.containsMouse ? "cyan" : "transparent" - - MouseArea { - id: buttonMA - objectName: "buttonMA" - hoverEnabled: true - cursorShape: Qt.UpArrowCursor - anchors.fill: parent - onClicked: console.log("clicked MA") - } - - Text { - anchors.centerIn: parent - text: "MouseArea" - } + Text { + anchors.centerIn: parent + text: "HoverHandler" } - Rectangle { - objectName: "buttonWithHH" - width: parent.width - height: 30 - color: flash ? "#999" : "white" - border.color: buttonHH.hovered ? "cyan" : "transparent" - property bool flash: true - - HoverHandler { - id: buttonHH - objectName: "buttonHH" - acceptedDevices: PointerDevice.AllDevices - blocking: hoverBlockingCB.checked - cursorShape: tapHandler.pressed ? Qt.BusyCursor : Qt.PointingHandCursor - } - - TapHandler { - id: tapHandler - onTapped: tapFlash.start() - } - - Text { - anchors.centerIn: parent - text: "HoverHandler" - } - - FlashAnimation on flash { - id: tapFlash - } + FlashAnimation on flash { + id: tapFlash } } } @@ -135,9 +132,7 @@ Rectangle { cursorShape: Qt.OpenHandCursor } - Loader { - objectName: "topSidebarLoader" - sourceComponent: buttonsAndStuff + ButtonsAndStuff { anchors.fill: parent } @@ -166,9 +161,7 @@ Rectangle { cursorShape: Qt.ClosedHandCursor anchors.fill: parent - Loader { - objectName: "bottomSidebarLoader" - sourceComponent: buttonsAndStuff + ButtonsAndStuff { anchors.fill: parent } } diff --git a/examples/quick/quick-accessibility/Button.qml b/examples/quick/quick-accessibility/Button.qml index 84debed4d0..bd23307e97 100644 --- a/examples/quick/quick-accessibility/Button.qml +++ b/examples/quick/quick-accessibility/Button.qml @@ -1,7 +1,7 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Rectangle { id: button diff --git a/examples/quick/quick-accessibility/Checkbox.qml b/examples/quick/quick-accessibility/Checkbox.qml index eea1bf152e..a3a0f286f1 100644 --- a/examples/quick/quick-accessibility/Checkbox.qml +++ b/examples/quick/quick-accessibility/Checkbox.qml @@ -1,7 +1,7 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick FocusScope { id: checkbox diff --git a/examples/quick/quick-accessibility/Slider.qml b/examples/quick/quick-accessibility/Slider.qml index 23e2a882ea..5dedec4915 100644 --- a/examples/quick/quick-accessibility/Slider.qml +++ b/examples/quick/quick-accessibility/Slider.qml @@ -1,7 +1,7 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick // Minimal slider implementation Rectangle { diff --git a/examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/test.qml b/examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/test.qml index b658f9b01d..a7e30e8917 100644 --- a/examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/test.qml +++ b/examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/test.qml @@ -1,9 +1,9 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.2 -import QtQuick.Particles 2.0 -import fbitem 1.0 +import QtQuick +import QtQuick.Particles +import fbitem Rectangle { id: root diff --git a/examples/quick/quickwidgets/quickwidget/rotatingsquare.qml b/examples/quick/quickwidgets/quickwidget/rotatingsquare.qml index 27e3644020..355c02f0cd 100644 --- a/examples/quick/quickwidgets/quickwidget/rotatingsquare.qml +++ b/examples/quick/quickwidgets/quickwidget/rotatingsquare.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.8 +import QtQuick Rectangle { id: root diff --git a/examples/quick/scenegraph/customgeometry/main.qml b/examples/quick/scenegraph/customgeometry/main.qml index e094b78081..2f440b441e 100644 --- a/examples/quick/scenegraph/customgeometry/main.qml +++ b/examples/quick/scenegraph/customgeometry/main.qml @@ -2,8 +2,8 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause //! [1] -import QtQuick 2.0 -import CustomGeometry 1.0 +import QtQuick +import CustomGeometry //! [1] //! [2] Item { width: 300 diff --git a/examples/quick/scenegraph/custommaterial/main.qml b/examples/quick/scenegraph/custommaterial/main.qml index ed7de5df0a..9626711d38 100644 --- a/examples/quick/scenegraph/custommaterial/main.qml +++ b/examples/quick/scenegraph/custommaterial/main.qml @@ -1,8 +1,8 @@ // Copyright (C) 2020 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.2 -import ExampleCustomMaterial 1.0 +import QtQuick +import ExampleCustomMaterial Item { id: root diff --git a/examples/quick/scenegraph/d3d11underqml/main.qml b/examples/quick/scenegraph/d3d11underqml/main.qml index 1ac3e1094a..939f42cd26 100644 --- a/examples/quick/scenegraph/d3d11underqml/main.qml +++ b/examples/quick/scenegraph/d3d11underqml/main.qml @@ -2,8 +2,8 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause //! [1] -import QtQuick 2.0 -import D3D11UnderQML 1.0 +import QtQuick +import D3D11UnderQML Item { diff --git a/examples/quick/scenegraph/fboitem/main.qml b/examples/quick/scenegraph/fboitem/main.qml index 32fb88d2c7..78f0f27e74 100644 --- a/examples/quick/scenegraph/fboitem/main.qml +++ b/examples/quick/scenegraph/fboitem/main.qml @@ -1,9 +1,9 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick -import SceneGraphRendering 1.0 +import SceneGraphRendering Item { width: 400 diff --git a/examples/quick/scenegraph/graph/main.qml b/examples/quick/scenegraph/graph/main.qml index 614f9b6eae..e9b684c3ba 100644 --- a/examples/quick/scenegraph/graph/main.qml +++ b/examples/quick/scenegraph/graph/main.qml @@ -1,9 +1,9 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick -import Graph 1.0 +import Graph Item { width: 800 diff --git a/examples/quick/scenegraph/graph/noisynode.cpp b/examples/quick/scenegraph/graph/noisynode.cpp index e62fb2182e..8f5d93dc35 100644 --- a/examples/quick/scenegraph/graph/noisynode.cpp +++ b/examples/quick/scenegraph/graph/noisynode.cpp @@ -102,6 +102,7 @@ void NoisyShader::updateSampledImage(RenderState &state, int binding, QSGTexture Q_UNUSED(binding); NoisyMaterial *mat = static_cast<NoisyMaterial *>(newMaterial); + mat->state.texture->commitTextureOperations(state.rhi(), state.resourceUpdateBatch()); *texture = mat->state.texture; } diff --git a/examples/quick/scenegraph/metaltextureimport/main.qml b/examples/quick/scenegraph/metaltextureimport/main.qml index f541696f38..dfc6252910 100644 --- a/examples/quick/scenegraph/metaltextureimport/main.qml +++ b/examples/quick/scenegraph/metaltextureimport/main.qml @@ -1,9 +1,9 @@ // Copyright (C) 2019 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick //! [1] -import MetalTextureImport 1.0 +import MetalTextureImport //! [1] Rectangle { diff --git a/examples/quick/scenegraph/metalunderqml/main.qml b/examples/quick/scenegraph/metalunderqml/main.qml index 2417bb1644..3329822eb1 100644 --- a/examples/quick/scenegraph/metalunderqml/main.qml +++ b/examples/quick/scenegraph/metalunderqml/main.qml @@ -2,8 +2,8 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause //! [1] -import QtQuick 2.0 -import MetalUnderQML 1.0 +import QtQuick +import MetalUnderQML Item { diff --git a/examples/quick/scenegraph/openglunderqml/main.qml b/examples/quick/scenegraph/openglunderqml/main.qml index e0a09b754d..46cbef18eb 100644 --- a/examples/quick/scenegraph/openglunderqml/main.qml +++ b/examples/quick/scenegraph/openglunderqml/main.qml @@ -2,8 +2,8 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause //! [1] -import QtQuick 2.0 -import OpenGLUnderQML 1.0 +import QtQuick +import OpenGLUnderQML Item { diff --git a/examples/quick/scenegraph/threadedanimation/main.qml b/examples/quick/scenegraph/threadedanimation/main.qml index f1220c3321..33e72af1f1 100644 --- a/examples/quick/scenegraph/threadedanimation/main.qml +++ b/examples/quick/scenegraph/threadedanimation/main.qml @@ -2,8 +2,8 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause //! [1] -import QtQuick 2.0 -import Spinner 1.0 +import QtQuick +import Spinner Rectangle { diff --git a/examples/quick/scenegraph/twotextureproviders/main.qml b/examples/quick/scenegraph/twotextureproviders/main.qml index e52eafa5df..e28f6347a8 100644 --- a/examples/quick/scenegraph/twotextureproviders/main.qml +++ b/examples/quick/scenegraph/twotextureproviders/main.qml @@ -1,8 +1,8 @@ // Copyright (C) 2014 Gunnar Sletta <gunnar@sletta.org> // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.2 -import SceneGraphRendering 1.0 +import QtQuick +import SceneGraphRendering Item { id: root diff --git a/examples/quick/scenegraph/vulkantextureimport/main.qml b/examples/quick/scenegraph/vulkantextureimport/main.qml index 3d2699ace8..081a496bca 100644 --- a/examples/quick/scenegraph/vulkantextureimport/main.qml +++ b/examples/quick/scenegraph/vulkantextureimport/main.qml @@ -1,9 +1,9 @@ // Copyright (C) 2019 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick //! [1] -import VulkanTextureImport 1.0 +import VulkanTextureImport //! [1] Rectangle { diff --git a/examples/quick/scenegraph/vulkanunderqml/main.qml b/examples/quick/scenegraph/vulkanunderqml/main.qml index 4dfac2c724..bae014b328 100644 --- a/examples/quick/scenegraph/vulkanunderqml/main.qml +++ b/examples/quick/scenegraph/vulkanunderqml/main.qml @@ -2,8 +2,8 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause //! [1] -import QtQuick 2.0 -import VulkanUnderQML 1.0 +import QtQuick +import VulkanUnderQML Item { diff --git a/examples/quick/shared/Button.qml b/examples/quick/shared/Button.qml index bee0ae28e1..31e88fe541 100644 --- a/examples/quick/shared/Button.qml +++ b/examples/quick/shared/Button.qml @@ -1,8 +1,8 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.12 -import QtQuick.Window 2.1 +import QtQuick +import QtQuick.Window Item { id: container diff --git a/examples/quick/shared/CheckBox.qml b/examples/quick/shared/CheckBox.qml index ed93d708da..45c4f4e674 100644 --- a/examples/quick/shared/CheckBox.qml +++ b/examples/quick/shared/CheckBox.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.12 +import QtQuick Item { id: root diff --git a/examples/quick/shared/FlickrRssModel.qml b/examples/quick/shared/FlickrRssModel.qml index 66f53b8ef5..e78d1ffa21 100644 --- a/examples/quick/shared/FlickrRssModel.qml +++ b/examples/quick/shared/FlickrRssModel.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.12 +import QtQuick ListModel { id: flickrImages diff --git a/examples/quick/shared/Label.qml b/examples/quick/shared/Label.qml index 77ec53f5c2..5393336cab 100644 --- a/examples/quick/shared/Label.qml +++ b/examples/quick/shared/Label.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Text { SystemPalette { id: palette } diff --git a/examples/quick/shared/LauncherList.qml b/examples/quick/shared/LauncherList.qml index 323ed529fe..ee8fc3984e 100644 --- a/examples/quick/shared/LauncherList.qml +++ b/examples/quick/shared/LauncherList.qml @@ -2,9 +2,9 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQml 2.12 -import QtQml.Models 2.12 -import QtQuick 2.12 +import QtQml +import QtQml.Models +import QtQuick Rectangle { id: root diff --git a/examples/quick/shared/SimpleLauncherDelegate.qml b/examples/quick/shared/SimpleLauncherDelegate.qml index 68860edbc2..c6ca9802d2 100644 --- a/examples/quick/shared/SimpleLauncherDelegate.qml +++ b/examples/quick/shared/SimpleLauncherDelegate.qml @@ -1,6 +1,6 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.12 +import QtQuick Rectangle { id: container diff --git a/examples/quick/shared/Slider.qml b/examples/quick/shared/Slider.qml index 7b331ab1c6..b8bb6ed30c 100644 --- a/examples/quick/shared/Slider.qml +++ b/examples/quick/shared/Slider.qml @@ -1,7 +1,7 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.12 +import QtQuick Item { id: slider diff --git a/examples/quick/shared/TabSet.qml b/examples/quick/shared/TabSet.qml index 633521af8e..d9ae7d7b6d 100644 --- a/examples/quick/shared/TabSet.qml +++ b/examples/quick/shared/TabSet.qml @@ -1,8 +1,8 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.12 -import QtQuick.Window 2.1 +import QtQuick +import QtQuick.Window Item { id: tabWidget diff --git a/examples/quick/shared/TextField.qml b/examples/quick/shared/TextField.qml index 01addb2e97..66854c89bf 100644 --- a/examples/quick/shared/TextField.qml +++ b/examples/quick/shared/TextField.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.1 +import QtQuick Item { id: root diff --git a/examples/quick/tableview/gameoflife/main.qml b/examples/quick/tableview/gameoflife/main.qml index 41c5f9dcfb..9e9f9e6905 100644 --- a/examples/quick/tableview/gameoflife/main.qml +++ b/examples/quick/tableview/gameoflife/main.qml @@ -1,12 +1,12 @@ // Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQml 2.12 -import QtQuick 2.12 -import QtQuick.Window 2.3 -import QtQuick.Controls 2.2 -import QtQuick.Layouts 1.3 -import GameOfLifeModel 1.0 +import QtQml +import QtQuick +import QtQuick.Window +import QtQuick.Controls +import QtQuick.Layouts +import GameOfLifeModel ApplicationWindow { id: root diff --git a/examples/quick/tableview/pixelator/main.qml b/examples/quick/tableview/pixelator/main.qml index 05a9d1ebde..67a4ff5a36 100644 --- a/examples/quick/tableview/pixelator/main.qml +++ b/examples/quick/tableview/pixelator/main.qml @@ -1,11 +1,11 @@ // Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.12 +import QtQuick -import QtQuick.Window 2.12 +import QtQuick.Window -import ImageModel 1.0 +import ImageModel Window { visible: true diff --git a/examples/quick/text/fonts/availableFonts.qml b/examples/quick/text/fonts/availableFonts.qml index 7cfeae3465..2564bb6447 100644 --- a/examples/quick/text/fonts/availableFonts.qml +++ b/examples/quick/text/fonts/availableFonts.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Rectangle { width: 320; height: 480; color: "steelblue" diff --git a/examples/quick/text/fonts/banner.qml b/examples/quick/text/fonts/banner.qml index 3902bd18cb..2c0742018a 100644 --- a/examples/quick/text/fonts/banner.qml +++ b/examples/quick/text/fonts/banner.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Rectangle { id: screen diff --git a/examples/quick/text/fonts/fonts.qml b/examples/quick/text/fonts/fonts.qml index e904a5664c..8e0f906493 100644 --- a/examples/quick/text/fonts/fonts.qml +++ b/examples/quick/text/fonts/fonts.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Rectangle { id: root diff --git a/examples/quick/text/fonts/hello.qml b/examples/quick/text/fonts/hello.qml index 6874544d0e..e0cdc26ea6 100644 --- a/examples/quick/text/fonts/hello.qml +++ b/examples/quick/text/fonts/hello.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Rectangle { id: screen diff --git a/examples/quick/text/imgtag/TextWithImage.qml b/examples/quick/text/imgtag/TextWithImage.qml index be6f65a32c..0fdd208368 100644 --- a/examples/quick/text/imgtag/TextWithImage.qml +++ b/examples/quick/text/imgtag/TextWithImage.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Text { width: parent.width diff --git a/examples/quick/text/imgtag/imgtag.qml b/examples/quick/text/imgtag/imgtag.qml index 45fd5b6196..689d07aabb 100644 --- a/examples/quick/text/imgtag/imgtag.qml +++ b/examples/quick/text/imgtag/imgtag.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Rectangle { id: main diff --git a/examples/quick/text/styledtext-layout.qml b/examples/quick/text/styledtext-layout.qml index 5a4c97e35e..4f63d3ea90 100644 --- a/examples/quick/text/styledtext-layout.qml +++ b/examples/quick/text/styledtext-layout.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Rectangle { id: main diff --git a/examples/quick/text/text.qml b/examples/quick/text/text.qml index a2e3072e04..8f1c24ebc2 100644 --- a/examples/quick/text/text.qml +++ b/examples/quick/text/text.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick import shared Item { diff --git a/examples/quick/text/textselection/textselection.qml b/examples/quick/text/textselection/textselection.qml index 68d74146e4..d4224ee14c 100644 --- a/examples/quick/text/textselection/textselection.qml +++ b/examples/quick/text/textselection/textselection.qml @@ -1,6 +1,6 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Rectangle { id: editor diff --git a/examples/quick/threading/threadedlistmodel/timedisplay.qml b/examples/quick/threading/threadedlistmodel/timedisplay.qml index d8781b70be..9c14fb1d11 100644 --- a/examples/quick/threading/threadedlistmodel/timedisplay.qml +++ b/examples/quick/threading/threadedlistmodel/timedisplay.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Rectangle { color: "white" diff --git a/examples/quick/threading/threading.qml b/examples/quick/threading/threading.qml index 843e56faf7..55a61ee155 100644 --- a/examples/quick/threading/threading.qml +++ b/examples/quick/threading/threading.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick import shared as Examples Item { diff --git a/examples/quick/threading/workerscript/Spinner.qml b/examples/quick/threading/workerscript/Spinner.qml index 3a937339b4..c21433961e 100644 --- a/examples/quick/threading/workerscript/Spinner.qml +++ b/examples/quick/threading/workerscript/Spinner.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Rectangle { width: 64 diff --git a/examples/quick/threading/workerscript/workerscript.qml b/examples/quick/threading/workerscript/workerscript.qml index 931b0d2247..3d01f90968 100644 --- a/examples/quick/threading/workerscript/workerscript.qml +++ b/examples/quick/threading/workerscript/workerscript.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Rectangle { width: 320; height: 480 diff --git a/examples/quick/touchinteraction/flickable/Panel.qml b/examples/quick/touchinteraction/flickable/Panel.qml index 217178f803..25c864799e 100644 --- a/examples/quick/touchinteraction/flickable/Panel.qml +++ b/examples/quick/touchinteraction/flickable/Panel.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Item { required property string name diff --git a/examples/quick/touchinteraction/flickable/basic-flickable.qml b/examples/quick/touchinteraction/flickable/basic-flickable.qml index a96aa42962..d529f0bec2 100644 --- a/examples/quick/touchinteraction/flickable/basic-flickable.qml +++ b/examples/quick/touchinteraction/flickable/basic-flickable.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick //![0] Rectangle { diff --git a/examples/quick/touchinteraction/flickable/corkboards.qml b/examples/quick/touchinteraction/flickable/corkboards.qml index 0956b6a04c..a8b9032dfd 100644 --- a/examples/quick/touchinteraction/flickable/corkboards.qml +++ b/examples/quick/touchinteraction/flickable/corkboards.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Rectangle { width: 320; height: 480 diff --git a/examples/quick/touchinteraction/multipointtouch/AugmentedTouchPoint.qml b/examples/quick/touchinteraction/multipointtouch/AugmentedTouchPoint.qml index ab44f9a56d..b1d162bbd3 100644 --- a/examples/quick/touchinteraction/multipointtouch/AugmentedTouchPoint.qml +++ b/examples/quick/touchinteraction/multipointtouch/AugmentedTouchPoint.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 -import QtQuick.Particles 2.0 +import QtQuick +import QtQuick.Particles //! [0] TouchPoint { diff --git a/examples/quick/touchinteraction/multipointtouch/BearWhackParticleSystem.qml b/examples/quick/touchinteraction/multipointtouch/BearWhackParticleSystem.qml index 1621490c3d..6537f37087 100644 --- a/examples/quick/touchinteraction/multipointtouch/BearWhackParticleSystem.qml +++ b/examples/quick/touchinteraction/multipointtouch/BearWhackParticleSystem.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 -import QtQuick.Particles 2.0 +import QtQuick +import QtQuick.Particles ParticleSystem { id: particleSystem diff --git a/examples/quick/touchinteraction/multipointtouch/ParticleFlame.qml b/examples/quick/touchinteraction/multipointtouch/ParticleFlame.qml index d357ceb81d..66907b1f0d 100644 --- a/examples/quick/touchinteraction/multipointtouch/ParticleFlame.qml +++ b/examples/quick/touchinteraction/multipointtouch/ParticleFlame.qml @@ -1,8 +1,8 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 -import QtQuick.Particles 2.0 +import QtQuick +import QtQuick.Particles ParticleSystem { anchors.fill: parent diff --git a/examples/quick/touchinteraction/multipointtouch/bearwhack.qml b/examples/quick/touchinteraction/multipointtouch/bearwhack.qml index 73ce2452c6..c5f7dc585c 100644 --- a/examples/quick/touchinteraction/multipointtouch/bearwhack.qml +++ b/examples/quick/touchinteraction/multipointtouch/bearwhack.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 -import QtQuick.Particles 2.0 +import QtQuick +import QtQuick.Particles Item { id: root diff --git a/examples/quick/touchinteraction/multipointtouch/multiflame.qml b/examples/quick/touchinteraction/multipointtouch/multiflame.qml index cdb882c607..3e03bf2815 100644 --- a/examples/quick/touchinteraction/multipointtouch/multiflame.qml +++ b/examples/quick/touchinteraction/multipointtouch/multiflame.qml @@ -1,6 +1,6 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Rectangle { width: 360 diff --git a/examples/quick/touchinteraction/pincharea/flickresize.qml b/examples/quick/touchinteraction/pincharea/flickresize.qml index a8bd67a306..16108be1a7 100644 --- a/examples/quick/touchinteraction/pincharea/flickresize.qml +++ b/examples/quick/touchinteraction/pincharea/flickresize.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Rectangle { width: 640 diff --git a/examples/quick/touchinteraction/touchinteraction.qml b/examples/quick/touchinteraction/touchinteraction.qml index 5e3fb6b3c5..6961e48fd4 100644 --- a/examples/quick/touchinteraction/touchinteraction.qml +++ b/examples/quick/touchinteraction/touchinteraction.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick import shared Item { diff --git a/examples/quick/tutorials/dynamicview/dynamicview1/PetsModel.qml b/examples/quick/tutorials/dynamicview/dynamicview1/PetsModel.qml index d201b3e6f4..45c43909e4 100644 --- a/examples/quick/tutorials/dynamicview/dynamicview1/PetsModel.qml +++ b/examples/quick/tutorials/dynamicview/dynamicview1/PetsModel.qml @@ -2,7 +2,7 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause //![0] -import QtQuick 2.0 +import QtQuick ListModel { ListElement { diff --git a/examples/quick/tutorials/dynamicview/dynamicview1/dynamicview.qml b/examples/quick/tutorials/dynamicview/dynamicview1/dynamicview.qml index cab7fa9a6e..ec776d4153 100644 --- a/examples/quick/tutorials/dynamicview/dynamicview1/dynamicview.qml +++ b/examples/quick/tutorials/dynamicview/dynamicview1/dynamicview.qml @@ -1,8 +1,9 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +pragma ComponentBehavior: Bound //![0] -import QtQuick 2.0 +import QtQuick Rectangle { id: root @@ -16,7 +17,12 @@ Rectangle { Rectangle { id: content - anchors { left: parent.left; right: parent.right } + required property string name + required property string type + required property string size + required property int age + + width: view.width height: column.implicitHeight + 4 border.width: 1 diff --git a/examples/quick/tutorials/dynamicview/dynamicview2/PetsModel.qml b/examples/quick/tutorials/dynamicview/dynamicview2/PetsModel.qml index 2faae2a10b..acdab53c20 100644 --- a/examples/quick/tutorials/dynamicview/dynamicview2/PetsModel.qml +++ b/examples/quick/tutorials/dynamicview/dynamicview2/PetsModel.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick ListModel { ListElement { diff --git a/examples/quick/tutorials/dynamicview/dynamicview2/dynamicview.qml b/examples/quick/tutorials/dynamicview/dynamicview2/dynamicview.qml index ab1f1c0b08..99b1bbdaa1 100644 --- a/examples/quick/tutorials/dynamicview/dynamicview2/dynamicview.qml +++ b/examples/quick/tutorials/dynamicview/dynamicview2/dynamicview.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Rectangle { id: root diff --git a/examples/quick/tutorials/dynamicview/dynamicview3/PetsModel.qml b/examples/quick/tutorials/dynamicview/dynamicview3/PetsModel.qml index 2faae2a10b..acdab53c20 100644 --- a/examples/quick/tutorials/dynamicview/dynamicview3/PetsModel.qml +++ b/examples/quick/tutorials/dynamicview/dynamicview3/PetsModel.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick ListModel { ListElement { diff --git a/examples/quick/tutorials/dynamicview/dynamicview3/dynamicview.qml b/examples/quick/tutorials/dynamicview/dynamicview3/dynamicview.qml index 92b2586dd0..ea88da4e53 100644 --- a/examples/quick/tutorials/dynamicview/dynamicview3/dynamicview.qml +++ b/examples/quick/tutorials/dynamicview/dynamicview3/dynamicview.qml @@ -1,8 +1,8 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 -import QtQml.Models 2.1 +import QtQuick +import QtQml.Models //![0] Rectangle { id: root diff --git a/examples/quick/tutorials/dynamicview/dynamicview4/ListSelector.qml b/examples/quick/tutorials/dynamicview/dynamicview4/ListSelector.qml index 2ea80e2d8d..42a200a936 100644 --- a/examples/quick/tutorials/dynamicview/dynamicview4/ListSelector.qml +++ b/examples/quick/tutorials/dynamicview/dynamicview4/ListSelector.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Item { id: selector diff --git a/examples/quick/tutorials/dynamicview/dynamicview4/PetsModel.qml b/examples/quick/tutorials/dynamicview/dynamicview4/PetsModel.qml index 2faae2a10b..acdab53c20 100644 --- a/examples/quick/tutorials/dynamicview/dynamicview4/PetsModel.qml +++ b/examples/quick/tutorials/dynamicview/dynamicview4/PetsModel.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick ListModel { ListElement { diff --git a/examples/quick/tutorials/dynamicview/dynamicview4/dynamicview.qml b/examples/quick/tutorials/dynamicview/dynamicview4/dynamicview.qml index 36f1ecdf4b..cb454c0d46 100644 --- a/examples/quick/tutorials/dynamicview/dynamicview4/dynamicview.qml +++ b/examples/quick/tutorials/dynamicview/dynamicview4/dynamicview.qml @@ -1,8 +1,8 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 -import QtQml.Models 2.1 +import QtQuick +import QtQml.Models Rectangle { id: root diff --git a/examples/quick/tutorials/helloworld/Cell.qml b/examples/quick/tutorials/helloworld/Cell.qml index 1910453869..d88b63cdfa 100644 --- a/examples/quick/tutorials/helloworld/Cell.qml +++ b/examples/quick/tutorials/helloworld/Cell.qml @@ -2,7 +2,7 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause //![0] -import QtQuick 2.0 +import QtQuick //![1] Item { diff --git a/examples/quick/tutorials/helloworld/tutorial1.qml b/examples/quick/tutorials/helloworld/tutorial1.qml index fe64925d27..c67bc75562 100644 --- a/examples/quick/tutorials/helloworld/tutorial1.qml +++ b/examples/quick/tutorials/helloworld/tutorial1.qml @@ -3,7 +3,7 @@ //![0] //![3] -import QtQuick 2.0 +import QtQuick //![3] //![1] diff --git a/examples/quick/tutorials/helloworld/tutorial2.qml b/examples/quick/tutorials/helloworld/tutorial2.qml index 917bee047e..8b1c632b99 100644 --- a/examples/quick/tutorials/helloworld/tutorial2.qml +++ b/examples/quick/tutorials/helloworld/tutorial2.qml @@ -2,7 +2,7 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause //![0] -import QtQuick 2.0 +import QtQuick Rectangle { id: page diff --git a/examples/quick/tutorials/helloworld/tutorial3.qml b/examples/quick/tutorials/helloworld/tutorial3.qml index e2d280494f..73833d2a67 100644 --- a/examples/quick/tutorials/helloworld/tutorial3.qml +++ b/examples/quick/tutorials/helloworld/tutorial3.qml @@ -2,7 +2,7 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause //![0] -import QtQuick 2.0 +import QtQuick Rectangle { id: page diff --git a/examples/quick/tutorials/samegame/samegame1/Block.qml b/examples/quick/tutorials/samegame/samegame1/Block.qml index d5fd8add3e..c10f0c4825 100644 --- a/examples/quick/tutorials/samegame/samegame1/Block.qml +++ b/examples/quick/tutorials/samegame/samegame1/Block.qml @@ -2,7 +2,7 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause //![0] -import QtQuick 2.0 +import QtQuick Item { id: block diff --git a/examples/quick/tutorials/samegame/samegame1/Button.qml b/examples/quick/tutorials/samegame/samegame1/Button.qml index b2d62b3c18..cc87465e3c 100644 --- a/examples/quick/tutorials/samegame/samegame1/Button.qml +++ b/examples/quick/tutorials/samegame/samegame1/Button.qml @@ -2,7 +2,7 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause //![0] -import QtQuick 2.0 +import QtQuick Rectangle { id: container diff --git a/examples/quick/tutorials/samegame/samegame1/samegame.qml b/examples/quick/tutorials/samegame/samegame1/samegame.qml index dafe6abaf6..fe21acae99 100644 --- a/examples/quick/tutorials/samegame/samegame1/samegame.qml +++ b/examples/quick/tutorials/samegame/samegame1/samegame.qml @@ -2,7 +2,7 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause //![0] -import QtQuick 2.0 +import QtQuick Rectangle { id: screen diff --git a/examples/quick/tutorials/samegame/samegame2/Block.qml b/examples/quick/tutorials/samegame/samegame2/Block.qml index 79ac9392bf..b0416f0e15 100644 --- a/examples/quick/tutorials/samegame/samegame2/Block.qml +++ b/examples/quick/tutorials/samegame/samegame2/Block.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Item { id: block diff --git a/examples/quick/tutorials/samegame/samegame2/Button.qml b/examples/quick/tutorials/samegame/samegame2/Button.qml index 45b370d1f2..1a365e6dd9 100644 --- a/examples/quick/tutorials/samegame/samegame2/Button.qml +++ b/examples/quick/tutorials/samegame/samegame2/Button.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Rectangle { id: container diff --git a/examples/quick/tutorials/samegame/samegame2/samegame.qml b/examples/quick/tutorials/samegame/samegame2/samegame.qml index ebc67793ed..642a474ebd 100644 --- a/examples/quick/tutorials/samegame/samegame2/samegame.qml +++ b/examples/quick/tutorials/samegame/samegame2/samegame.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick //![2] import "samegame.js" as SameGame //![2] diff --git a/examples/quick/tutorials/samegame/samegame3/Block.qml b/examples/quick/tutorials/samegame/samegame3/Block.qml index 7fa2bf7b79..71d25c19db 100644 --- a/examples/quick/tutorials/samegame/samegame3/Block.qml +++ b/examples/quick/tutorials/samegame/samegame3/Block.qml @@ -2,7 +2,7 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause //![0] -import QtQuick 2.0 +import QtQuick Item { id: block diff --git a/examples/quick/tutorials/samegame/samegame3/Button.qml b/examples/quick/tutorials/samegame/samegame3/Button.qml index 45b370d1f2..1a365e6dd9 100644 --- a/examples/quick/tutorials/samegame/samegame3/Button.qml +++ b/examples/quick/tutorials/samegame/samegame3/Button.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Rectangle { id: container diff --git a/examples/quick/tutorials/samegame/samegame3/Dialog.qml b/examples/quick/tutorials/samegame/samegame3/Dialog.qml index ea546c7738..3620da5799 100644 --- a/examples/quick/tutorials/samegame/samegame3/Dialog.qml +++ b/examples/quick/tutorials/samegame/samegame3/Dialog.qml @@ -2,7 +2,7 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause //![0] -import QtQuick 2.0 +import QtQuick Rectangle { id: container diff --git a/examples/quick/tutorials/samegame/samegame3/samegame.qml b/examples/quick/tutorials/samegame/samegame3/samegame.qml index 30ff19c96b..dadd089e24 100644 --- a/examples/quick/tutorials/samegame/samegame3/samegame.qml +++ b/examples/quick/tutorials/samegame/samegame3/samegame.qml @@ -2,7 +2,7 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause //![0] -import QtQuick 2.0 +import QtQuick import "samegame.js" as SameGame Rectangle { diff --git a/examples/quick/tutorials/samegame/samegame4/BoomBlock.qml b/examples/quick/tutorials/samegame/samegame4/BoomBlock.qml index 7a10fb6b22..fa6b1d45a1 100644 --- a/examples/quick/tutorials/samegame/samegame4/BoomBlock.qml +++ b/examples/quick/tutorials/samegame/samegame4/BoomBlock.qml @@ -1,8 +1,8 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 -import QtQuick.Particles 2.0 +import QtQuick +import QtQuick.Particles Item { id: block diff --git a/examples/quick/tutorials/samegame/samegame4/Button.qml b/examples/quick/tutorials/samegame/samegame4/Button.qml index 45b370d1f2..1a365e6dd9 100644 --- a/examples/quick/tutorials/samegame/samegame4/Button.qml +++ b/examples/quick/tutorials/samegame/samegame4/Button.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Rectangle { id: container diff --git a/examples/quick/tutorials/samegame/samegame4/Dialog.qml b/examples/quick/tutorials/samegame/samegame4/Dialog.qml index 05c847dc90..3d3a04b66b 100644 --- a/examples/quick/tutorials/samegame/samegame4/Dialog.qml +++ b/examples/quick/tutorials/samegame/samegame4/Dialog.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick //![0] Rectangle { diff --git a/examples/quick/tutorials/samegame/samegame4/samegame.qml b/examples/quick/tutorials/samegame/samegame4/samegame.qml index bd4edbde69..b253e966f5 100644 --- a/examples/quick/tutorials/samegame/samegame4/samegame.qml +++ b/examples/quick/tutorials/samegame/samegame4/samegame.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick import "samegame.js" as SameGame Rectangle { diff --git a/examples/quick/views/delegatemodel/dragselection.qml b/examples/quick/views/delegatemodel/dragselection.qml index bc45c5c93a..1a66264e1d 100644 --- a/examples/quick/views/delegatemodel/dragselection.qml +++ b/examples/quick/views/delegatemodel/dragselection.qml @@ -1,9 +1,9 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQml 2.0 -import QtQuick 2.0 -import QtQml.Models 2.1 +import QtQml +import QtQuick +import QtQml.Models Item { id: root diff --git a/examples/quick/views/delegatemodel/slideshow.qml b/examples/quick/views/delegatemodel/slideshow.qml index 695f0374d9..c11a72147f 100644 --- a/examples/quick/views/delegatemodel/slideshow.qml +++ b/examples/quick/views/delegatemodel/slideshow.qml @@ -1,8 +1,8 @@ // Copyright (C) 2018 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.12 -import QtQml.Models 2.12 +import QtQuick +import QtQml.Models import shared as Shared Rectangle { diff --git a/examples/quick/views/gridview/gridview-example.qml b/examples/quick/views/gridview/gridview-example.qml index d85606f1c7..3f849565ca 100644 --- a/examples/quick/views/gridview/gridview-example.qml +++ b/examples/quick/views/gridview/gridview-example.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Rectangle { width: 300; height: 400 diff --git a/examples/quick/views/listview/content/PetsModel.qml b/examples/quick/views/listview/content/PetsModel.qml index 2faae2a10b..acdab53c20 100644 --- a/examples/quick/views/listview/content/PetsModel.qml +++ b/examples/quick/views/listview/content/PetsModel.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick ListModel { ListElement { diff --git a/examples/quick/views/listview/content/PressAndHoldButton.qml b/examples/quick/views/listview/content/PressAndHoldButton.qml index 0fa9b97d08..cdd2fb963d 100644 --- a/examples/quick/views/listview/content/PressAndHoldButton.qml +++ b/examples/quick/views/listview/content/PressAndHoldButton.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Image { id: container diff --git a/examples/quick/views/listview/content/RecipesModel.qml b/examples/quick/views/listview/content/RecipesModel.qml index 91a9cb2554..14b374a4c7 100644 --- a/examples/quick/views/listview/content/RecipesModel.qml +++ b/examples/quick/views/listview/content/RecipesModel.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick ListModel { ListElement { diff --git a/examples/quick/views/listview/content/SmallText.qml b/examples/quick/views/listview/content/SmallText.qml index 0c7a2674be..a808e3a27d 100644 --- a/examples/quick/views/listview/content/SmallText.qml +++ b/examples/quick/views/listview/content/SmallText.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Text { font.pixelSize: 12 diff --git a/examples/quick/views/listview/content/TextButton.qml b/examples/quick/views/listview/content/TextButton.qml index b4d13bc67c..aef7aa79e0 100644 --- a/examples/quick/views/listview/content/TextButton.qml +++ b/examples/quick/views/listview/content/TextButton.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Rectangle { id: container diff --git a/examples/quick/views/listview/content/ToggleButton.qml b/examples/quick/views/listview/content/ToggleButton.qml index 0b196f5df6..19e2589f74 100644 --- a/examples/quick/views/listview/content/ToggleButton.qml +++ b/examples/quick/views/listview/content/ToggleButton.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Rectangle { id: root diff --git a/examples/quick/views/listview/displaymargin.qml b/examples/quick/views/listview/displaymargin.qml index 92d8c3a36a..c4c32bdd64 100644 --- a/examples/quick/views/listview/displaymargin.qml +++ b/examples/quick/views/listview/displaymargin.qml @@ -1,6 +1,6 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.3 +import QtQuick Item { width: 480; height: 320 diff --git a/examples/quick/views/listview/dynamiclist.qml b/examples/quick/views/listview/dynamiclist.qml index f57267dfa9..fe32ce23d7 100644 --- a/examples/quick/views/listview/dynamiclist.qml +++ b/examples/quick/views/listview/dynamiclist.qml @@ -1,6 +1,6 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick import "content" // This example shows how items can be dynamically added to and removed from diff --git a/examples/quick/views/listview/expandingdelegates.qml b/examples/quick/views/listview/expandingdelegates.qml index c215c9ab16..26f2288922 100644 --- a/examples/quick/views/listview/expandingdelegates.qml +++ b/examples/quick/views/listview/expandingdelegates.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick import "content" // This example illustrates expanding a list item to show a more detailed view. diff --git a/examples/quick/views/listview/highlight.qml b/examples/quick/views/listview/highlight.qml index b3af7de204..137347203a 100644 --- a/examples/quick/views/listview/highlight.qml +++ b/examples/quick/views/listview/highlight.qml @@ -5,7 +5,7 @@ // that uses a SpringAnimation to provide custom movement when the // highlight bar is moved between items. -import QtQuick 2.0 +import QtQuick import "content" Rectangle { diff --git a/examples/quick/views/listview/highlightranges.qml b/examples/quick/views/listview/highlightranges.qml index 470223728a..78f8b197d3 100644 --- a/examples/quick/views/listview/highlightranges.qml +++ b/examples/quick/views/listview/highlightranges.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick import "content" //! [0] diff --git a/examples/quick/views/listview/sections.qml b/examples/quick/views/listview/sections.qml index c0e51dc518..5b2dfc67cc 100644 --- a/examples/quick/views/listview/sections.qml +++ b/examples/quick/views/listview/sections.qml @@ -4,7 +4,7 @@ // This example shows how a ListView can be separated into sections using // the ListView.section attached property. -import QtQuick 2.0 +import QtQuick import "content" Rectangle { diff --git a/examples/quick/views/objectmodel/objectmodel.qml b/examples/quick/views/objectmodel/objectmodel.qml index d6ae007669..898ef7f9e2 100644 --- a/examples/quick/views/objectmodel/objectmodel.qml +++ b/examples/quick/views/objectmodel/objectmodel.qml @@ -4,8 +4,8 @@ // This example demonstrates placing items in a view using // an ObjectModel -import QtQuick 2.0 -import QtQml.Models 2.1 +import QtQuick +import QtQml.Models Rectangle { id: root diff --git a/examples/quick/views/package/Delegate.qml b/examples/quick/views/package/Delegate.qml index 9595d664c1..2e810aebec 100644 --- a/examples/quick/views/package/Delegate.qml +++ b/examples/quick/views/package/Delegate.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick //! [0] Package { diff --git a/examples/quick/views/package/view.qml b/examples/quick/views/package/view.qml index 7ae6085f5c..696557ed7c 100644 --- a/examples/quick/views/package/view.qml +++ b/examples/quick/views/package/view.qml @@ -1,8 +1,8 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 -import QtQml.Models 2.1 +import QtQuick +import QtQml.Models Rectangle { id: root diff --git a/examples/quick/views/pathview/pathview-example.qml b/examples/quick/views/pathview/pathview-example.qml index 0b524feb10..19fd470c04 100644 --- a/examples/quick/views/pathview/pathview-example.qml +++ b/examples/quick/views/pathview/pathview-example.qml @@ -1,7 +1,7 @@ // Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.0 +import QtQuick Rectangle { width: 400; height: 240 diff --git a/examples/quickcontrols2/chattutorial/chapter1/chapter1.pro b/examples/quickcontrols2/chattutorial/chapter1/chapter1.pro index 221bb855f5..6b50809f20 100644 --- a/examples/quickcontrols2/chattutorial/chapter1/chapter1.pro +++ b/examples/quickcontrols2/chattutorial/chapter1/chapter1.pro @@ -5,8 +5,9 @@ CONFIG += c++11 SOURCES += main.cpp -RESOURCES += \ - main.qml \ +resources.files = main.qml +resources.prefix = chapter1/ +RESOURCES += resources \ qtquickcontrols2.conf target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols2/chattutorial/chapter1 diff --git a/examples/quickcontrols2/chattutorial/chapter2/chapter2.pro b/examples/quickcontrols2/chattutorial/chapter2/chapter2.pro index e217934b7e..15429b7c89 100644 --- a/examples/quickcontrols2/chattutorial/chapter2/chapter2.pro +++ b/examples/quickcontrols2/chattutorial/chapter2/chapter2.pro @@ -5,7 +5,7 @@ CONFIG += c++11 SOURCES += main.cpp -RESOURCES += \ +resources.files = \ images/Albert_Einstein.png \ images/Albert_Einstein@2x.png \ images/Albert_Einstein@3x.png \ @@ -18,7 +18,9 @@ RESOURCES += \ images/Hans_Gude@2x.png \ images/Hans_Gude@3x.png \ images/Hans_Gude@4x.png \ - main.qml \ + main.qml +resources.prefix = chapter2/ +RESOURCES += resources \ qtquickcontrols2.conf target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols2/chattutorial/chapter2 diff --git a/examples/quickcontrols2/chattutorial/chapter3/chapter3.pro b/examples/quickcontrols2/chattutorial/chapter3/chapter3.pro index a5e500d9db..42adc69fe9 100644 --- a/examples/quickcontrols2/chattutorial/chapter3/chapter3.pro +++ b/examples/quickcontrols2/chattutorial/chapter3/chapter3.pro @@ -5,7 +5,7 @@ CONFIG += c++11 SOURCES += main.cpp -RESOURCES += \ +resources.files = \ ContactPage.qml \ ConversationPage.qml \ images/Albert_Einstein.png \ @@ -20,7 +20,9 @@ RESOURCES += \ images/Hans_Gude@2x.png \ images/Hans_Gude@3x.png \ images/Hans_Gude@4x.png \ - main.qml \ + main.qml +resources.prefix = chapter3/ +RESOURCES += resources \ qtquickcontrols2.conf target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols2/chattutorial/chapter3 diff --git a/examples/quickcontrols2/chattutorial/chapter4/chapter4.pro b/examples/quickcontrols2/chattutorial/chapter4/chapter4.pro index dd2241355b..ae8141f7f1 100644 --- a/examples/quickcontrols2/chattutorial/chapter4/chapter4.pro +++ b/examples/quickcontrols2/chattutorial/chapter4/chapter4.pro @@ -10,7 +10,7 @@ SOURCES += main.cpp \ sqlcontactmodel.cpp \ sqlconversationmodel.cpp -RESOURCES += \ +resources.files = \ ContactPage.qml \ ConversationPage.qml \ images/Albert_Einstein.png \ @@ -25,7 +25,9 @@ RESOURCES += \ images/Hans_Gude@2x.png \ images/Hans_Gude@3x.png \ images/Hans_Gude@4x.png \ - main.qml \ + main.qml +resources.prefix = chapter4/ +RESOURCES += resources \ qtquickcontrols2.conf target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols2/chattutorial/chapter4 diff --git a/examples/quickcontrols2/chattutorial/chapter5/chapter5.pro b/examples/quickcontrols2/chattutorial/chapter5/chapter5.pro index 1ca8998427..625642d7b5 100644 --- a/examples/quickcontrols2/chattutorial/chapter5/chapter5.pro +++ b/examples/quickcontrols2/chattutorial/chapter5/chapter5.pro @@ -10,7 +10,7 @@ SOURCES += main.cpp \ sqlcontactmodel.cpp \ sqlconversationmodel.cpp -RESOURCES += \ +resources.files = \ +Material/ChatToolBar.qml \ ChatToolBar.qml \ ContactPage.qml \ @@ -27,7 +27,9 @@ RESOURCES += \ images/Hans_Gude@2x.png \ images/Hans_Gude@3x.png \ images/Hans_Gude@4x.png \ - main.qml \ + main.qml +resources.prefix = chapter5/ +RESOURCES += resources \ qtquickcontrols2.conf target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols2/chattutorial/chapter5 diff --git a/examples/quickcontrols2/chattutorial/doc/src/qtquickcontrols2-chattutorial.qdoc b/examples/quickcontrols2/chattutorial/doc/src/qtquickcontrols2-chattutorial.qdoc index 31c25bfe1a..52228b900d 100644 --- a/examples/quickcontrols2/chattutorial/doc/src/qtquickcontrols2-chattutorial.qdoc +++ b/examples/quickcontrols2/chattutorial/doc/src/qtquickcontrols2-chattutorial.qdoc @@ -179,7 +179,7 @@ project. The \c SOURCES variable lists all of the source files that should be compiled. A similar variable, \c HEADERS, is available for header files. -\printline RESOURCES +\printuntil qtquickcontrols2 The next line tells \c qmake that we have a collection of \l {The Qt Resource System}{resources} that should be built into the diff --git a/examples/quickcontrols2/contactlist/CMakeLists.txt b/examples/quickcontrols2/contactlist/CMakeLists.txt index 58e6299263..3bf15f7c4d 100644 --- a/examples/quickcontrols2/contactlist/CMakeLists.txt +++ b/examples/quickcontrols2/contactlist/CMakeLists.txt @@ -11,41 +11,32 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/contactlist") find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick) -qt_add_executable(contactlist +qt_add_executable(contactlistexample WIN32 MACOSX_BUNDLE contactmodel.cpp contactmodel.h main.cpp ) -set_target_properties(contactlist PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE +qt_add_qml_module(contactlistexample + URI contactlist + VERSION 1.0 + NO_RESOURCE_TARGET_PATH + QML_FILES + "ContactDelegate.ui.qml" + "ContactDialog.qml" + "ContactForm.ui.qml" + "ContactView.ui.qml" + "SectionDelegate.ui.qml" + "contactlist.qml" + "designer/Backend/ContactModel.qml" ) -target_link_libraries(contactlist PUBLIC +target_link_libraries(contactlistexample PUBLIC Qt::Core Qt::Gui Qt::Quick ) -# Resources: -set(qmake_immediate_resource_files - "ContactDelegate.ui.qml" - "ContactDialog.qml" - "ContactForm.ui.qml" - "ContactView.ui.qml" - "SectionDelegate.ui.qml" - "contactlist.qml" - "designer/Backend/ContactModel.qml" -) - -qt6_add_resources(contactlist "qmake_immediate" - PREFIX - "/" - FILES - ${qmake_immediate_resource_files} -) - -install(TARGETS contactlist +install(TARGETS contactlistexample RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" diff --git a/examples/quickcontrols2/contactlist/contactlist.qml b/examples/quickcontrols2/contactlist/contactlist.qml index aa8ab08e65..28f887f2db 100644 --- a/examples/quickcontrols2/contactlist/contactlist.qml +++ b/examples/quickcontrols2/contactlist/contactlist.qml @@ -16,7 +16,7 @@ ApplicationWindow { ContactDialog { id: contactDialog - onFinished: { + onFinished: function(fullName, address, city, number) { if (currentContact === -1) contactView.model.append(fullName, address, city, number) else diff --git a/examples/quickcontrols2/eventcalendar/doc/src/qtquickcontrols2-eventcalendar.qdoc b/examples/quickcontrols2/eventcalendar/doc/src/qtquickcontrols2-eventcalendar.qdoc index af0bc07c57..cc0b031b51 100644 --- a/examples/quickcontrols2/eventcalendar/doc/src/qtquickcontrols2-eventcalendar.qdoc +++ b/examples/quickcontrols2/eventcalendar/doc/src/qtquickcontrols2-eventcalendar.qdoc @@ -8,7 +8,7 @@ \ingroup qtquickcontrols2-examples \brief A simple event calendar. - \image qtquickcontrols2-gallery-menu.png + \image qtquickcalendar-eventcalendar.png The Event Calendar example is a simple application that shows how to use \l DayOfWeekRow, \l WeekNumberColumn, and \l MonthGrid to create a calendar. diff --git a/examples/quickcontrols2/flatstyle/CMakeLists.txt b/examples/quickcontrols2/flatstyle/CMakeLists.txt index bc61738186..69b216864f 100644 --- a/examples/quickcontrols2/flatstyle/CMakeLists.txt +++ b/examples/quickcontrols2/flatstyle/CMakeLists.txt @@ -11,16 +11,28 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/flatstyle") find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick QuickControls2 Widgets) -qt_add_executable(flatstyle +qt_add_executable(flatstyleexample WIN32 MACOSX_BUNDLE main.cpp ) -set_target_properties(flatstyle PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE +qt_add_qml_module(flatstyleexample + URI flatstyle + VERSION 1.0 + NO_RESOURCE_TARGET_PATH + QML_FILES + "MainForm.ui.qml" + "flatstyle.qml" + "imports/Flat/Button.qml" + "imports/Flat/CheckBox.qml" + "imports/Flat/Switch.qml" + "imports/Theme/Theme.qml" + RESOURCES + "imports/Flat/qmldir" + "imports/Theme/qmldir" + "qtquickcontrols2.conf" ) -target_link_libraries(flatstyle PUBLIC +target_link_libraries(flatstyleexample PUBLIC Qt::Core Qt::Gui Qt::Quick @@ -28,27 +40,7 @@ target_link_libraries(flatstyle PUBLIC Qt::Widgets ) -# Resources: -set(qmake_immediate_resource_files - "MainForm.ui.qml" - "flatstyle.qml" - "imports/Flat/Button.qml" - "imports/Flat/CheckBox.qml" - "imports/Flat/Switch.qml" - "imports/Flat/qmldir" - "imports/Theme/Theme.qml" - "imports/Theme/qmldir" - "qtquickcontrols2.conf" -) - -qt6_add_resources(flatstyle "qmake_immediate" - PREFIX - "/" - FILES - ${qmake_immediate_resource_files} -) - -install(TARGETS flatstyle +install(TARGETS flatstyleexample RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" diff --git a/examples/quickcontrols2/gallery/CMakeLists.txt b/examples/quickcontrols2/gallery/CMakeLists.txt index 3d689fe6b1..fff4253b4b 100644 --- a/examples/quickcontrols2/gallery/CMakeLists.txt +++ b/examples/quickcontrols2/gallery/CMakeLists.txt @@ -11,16 +11,76 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/gallery") find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick QuickControls2) -qt_add_executable(gallery_controls2 +qt_add_executable(galleryexample WIN32 MACOSX_BUNDLE gallery.cpp ) -set_target_properties(gallery_controls2 PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE +qt_add_qml_module(galleryexample + URI gallery + VERSION 1.0 + NO_RESOURCE_TARGET_PATH + QML_FILES + "+Material/ToolBar.qml" + "ToolBar.qml" + "gallery.qml" + "pages/BusyIndicatorPage.qml" + "pages/ButtonPage.qml" + "pages/CheckBoxPage.qml" + "pages/ComboBoxPage.qml" + "pages/DelayButtonPage.qml" + "pages/DelegatePage.qml" + "pages/DialPage.qml" + "pages/DialogPage.qml" + "pages/FramePage.qml" + "pages/GroupBoxPage.qml" + "pages/PageIndicatorPage.qml" + "pages/ProgressBarPage.qml" + "pages/RadioButtonPage.qml" + "pages/RangeSliderPage.qml" + "pages/ScrollBarPage.qml" + "pages/ScrollIndicatorPage.qml" + "pages/ScrollablePage.qml" + "pages/SliderPage.qml" + "pages/SpinBoxPage.qml" + "pages/StackViewPage.qml" + "pages/SwipeViewPage.qml" + "pages/SwitchPage.qml" + "pages/TabBarPage.qml" + "pages/TextAreaPage.qml" + "pages/TextFieldPage.qml" + "pages/ToolTipPage.qml" + "pages/TumblerPage.qml" + RESOURCES + "icons/gallery/20x20/back.png" + "icons/gallery/20x20/drawer.png" + "icons/gallery/20x20/menu.png" + "icons/gallery/20x20@2/back.png" + "icons/gallery/20x20@2/drawer.png" + "icons/gallery/20x20@2/menu.png" + "icons/gallery/20x20@3/back.png" + "icons/gallery/20x20@3/drawer.png" + "icons/gallery/20x20@3/menu.png" + "icons/gallery/20x20@4/back.png" + "icons/gallery/20x20@4/drawer.png" + "icons/gallery/20x20@4/menu.png" + "icons/gallery/index.theme" + "images/arrow.png" + "images/arrow@2x.png" + "images/arrow@3x.png" + "images/arrow@4x.png" + "images/arrows.png" + "images/arrows@2x.png" + "images/arrows@3x.png" + "images/arrows@4x.png" + "images/qt-logo.png" + "images/qt-logo@2x.png" + "images/qt-logo@3x.png" + "images/qt-logo@4x.png" + "qmldir" + "qtquickcontrols2.conf" ) -target_link_libraries(gallery_controls2 PUBLIC +target_link_libraries(galleryexample PUBLIC Qt::Core Qt::Gui Qt::Quick @@ -31,78 +91,10 @@ if(UNIX AND NOT APPLE AND CMAKE_CROSSCOMPILING) find_package(Qt6 REQUIRED COMPONENTS QuickTemplates2) # Work around QTBUG-86533 - target_link_libraries(gallery_controls2 PRIVATE Qt::QuickTemplates2) + target_link_libraries(galleryexample PRIVATE Qt::QuickTemplates2) endif() -# Resources: -set(qmake_immediate_resource_files - "+Material/ToolBar.qml" - "ToolBar.qml" - "gallery.qml" - "icons/gallery/20x20/back.png" - "icons/gallery/20x20/drawer.png" - "icons/gallery/20x20/menu.png" - "icons/gallery/20x20@2/back.png" - "icons/gallery/20x20@2/drawer.png" - "icons/gallery/20x20@2/menu.png" - "icons/gallery/20x20@3/back.png" - "icons/gallery/20x20@3/drawer.png" - "icons/gallery/20x20@3/menu.png" - "icons/gallery/20x20@4/back.png" - "icons/gallery/20x20@4/drawer.png" - "icons/gallery/20x20@4/menu.png" - "icons/gallery/index.theme" - "images/arrow.png" - "images/arrow@2x.png" - "images/arrow@3x.png" - "images/arrow@4x.png" - "images/arrows.png" - "images/arrows@2x.png" - "images/arrows@3x.png" - "images/arrows@4x.png" - "images/qt-logo.png" - "images/qt-logo@2x.png" - "images/qt-logo@3x.png" - "images/qt-logo@4x.png" - "pages/BusyIndicatorPage.qml" - "pages/ButtonPage.qml" - "pages/CheckBoxPage.qml" - "pages/ComboBoxPage.qml" - "pages/DelayButtonPage.qml" - "pages/DelegatePage.qml" - "pages/DialPage.qml" - "pages/DialogPage.qml" - "pages/FramePage.qml" - "pages/GroupBoxPage.qml" - "pages/PageIndicatorPage.qml" - "pages/ProgressBarPage.qml" - "pages/RadioButtonPage.qml" - "pages/RangeSliderPage.qml" - "pages/ScrollBarPage.qml" - "pages/ScrollIndicatorPage.qml" - "pages/ScrollablePage.qml" - "pages/SliderPage.qml" - "pages/SpinBoxPage.qml" - "pages/StackViewPage.qml" - "pages/SwipeViewPage.qml" - "pages/SwitchPage.qml" - "pages/TabBarPage.qml" - "pages/TextAreaPage.qml" - "pages/TextFieldPage.qml" - "pages/ToolTipPage.qml" - "pages/TumblerPage.qml" - "qmldir" - "qtquickcontrols2.conf" -) - -qt6_add_resources(gallery_controls2 "qmake_immediate" - PREFIX - "/" - FILES - ${qmake_immediate_resource_files} -) - -install(TARGETS gallery_controls2 +install(TARGETS galleryexample RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" diff --git a/examples/quickcontrols2/imagine/automotive/CMakeLists.txt b/examples/quickcontrols2/imagine/automotive/CMakeLists.txt index 6316a61616..98b0af0668 100644 --- a/examples/quickcontrols2/imagine/automotive/CMakeLists.txt +++ b/examples/quickcontrols2/imagine/automotive/CMakeLists.txt @@ -11,175 +11,132 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/imagine/automotive find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick QuickControls2) -qt_add_executable(automotive +qt_add_executable(automotiveexample WIN32 MACOSX_BUNDLE automotive.cpp ) -set_target_properties(automotive PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE +qt_add_qml_module(automotiveexample + URI automotive + VERSION 1.0 + NO_RESOURCE_TARGET_PATH + QML_FILES + "qml/FeatureButton.qml" + "qml/LargeLabel.qml" + "qml/automotive.qml" + + RESOURCES + "icons/automotive/44x44/air-con.png" + "icons/automotive/44x44/command.png" + "icons/automotive/44x44/message.png" + "icons/automotive/44x44/music.png" + "icons/automotive/44x44/seats.png" + "icons/automotive/44x44/settings.png" + "icons/automotive/44x44/statistics.png" + "icons/automotive/44x44/windows.png" + "icons/automotive/44x44@2/air-con.png" + "icons/automotive/44x44@2/command.png" + "icons/automotive/44x44@2/message.png" + "icons/automotive/44x44@2/music.png" + "icons/automotive/44x44@2/navigation.png" + "icons/automotive/44x44@2/seats.png" + "icons/automotive/44x44@2/settings.png" + "icons/automotive/44x44@2/statistics.png" + "icons/automotive/44x44@2/windows.png" + "icons/automotive/icons.svg" + "icons/automotive/index.theme" + "icons/car.png" + "icons/car@2x.png" + "icons/warning.png" + "icons/warning@2x.png" + "icons/weather.png" + "icons/weather@2x.png" + "imagine-assets/applicationwindow-background.png" + "imagine-assets/applicationwindow-background@2x.png" + "imagine-assets/button-background-checked-hovered.9.png" + "imagine-assets/button-background-checked-hovered@2x.9.png" + "imagine-assets/button-background-checked.9.png" + "imagine-assets/button-background-checked@2x.9.png" + "imagine-assets/button-background-hovered.9.png" + "imagine-assets/button-background-hovered@2x.9.png" + "imagine-assets/button-background-pressed.9.png" + "imagine-assets/button-background-pressed@2x.9.png" + "imagine-assets/button-background.9.png" + "imagine-assets/button-background@2x.9.png" + "imagine-assets/dial-background-hovered.png" + "imagine-assets/dial-background-hovered@2x.png" + "imagine-assets/dial-background-pressed.png" + "imagine-assets/dial-background-pressed@2x.png" + "imagine-assets/dial-background.png" + "imagine-assets/dial-background@2x.png" + "imagine-assets/dial-handle-pressed.png" + "imagine-assets/dial-handle-pressed@2x.png" + "imagine-assets/dial-handle.png" + "imagine-assets/dial-handle@2x.png" + "imagine-assets/frame-background.9.png" + "imagine-assets/frame-background@2x.9.png" + "imagine-assets/itemdelegate-background-checked.9.png" + "imagine-assets/itemdelegate-background-checked@2x.9.png" + "imagine-assets/itemdelegate-background-hovered.9.png" + "imagine-assets/itemdelegate-background-hovered@2x.9.png" + "imagine-assets/itemdelegate-background-pressed.9.png" + "imagine-assets/itemdelegate-background-pressed@2x.9.png" + "imagine-assets/itemdelegate-background.9.png" + "imagine-assets/itemdelegate-background@2x.9.png" + "imagine-assets/radiobutton-indicator-checked-hovered.png" + "imagine-assets/radiobutton-indicator-checked-hovered@2x.png" + "imagine-assets/radiobutton-indicator-checked-pressed.png" + "imagine-assets/radiobutton-indicator-checked-pressed@2x.png" + "imagine-assets/radiobutton-indicator-checked.png" + "imagine-assets/radiobutton-indicator-checked@2x.png" + "imagine-assets/radiobutton-indicator-hovered.png" + "imagine-assets/radiobutton-indicator-hovered@2x.png" + "imagine-assets/radiobutton-indicator-pressed.png" + "imagine-assets/radiobutton-indicator-pressed@2x.png" + "imagine-assets/radiobutton-indicator.png" + "imagine-assets/radiobutton-indicator@2x.png" + "imagine-assets/scrollindicator-handle.png" + "imagine-assets/scrollindicator-handle@2x.png" + "imagine-assets/slider-background-horizontal.9.png" + "imagine-assets/slider-background-horizontal@2x.9.png" + "imagine-assets/slider-handle-hovered.png" + "imagine-assets/slider-handle-hovered@2x.png" + "imagine-assets/slider-handle-pressed.png" + "imagine-assets/slider-handle-pressed@2x.png" + "imagine-assets/slider-handle.png" + "imagine-assets/slider-handle@2x.png" + "imagine-assets/slider-progress-horizontal-pressed.9.png" + "imagine-assets/slider-progress-horizontal-pressed@2x.9.png" + "imagine-assets/slider-progress-horizontal.9.png" + "imagine-assets/slider-progress-horizontal@2x.9.png" + "imagine-assets/switchdelegate-background.9.png" + "imagine-assets/switchdelegate-background@2x.9.png" + "imagine-assets/switchdelegate-handle-checked-hovered.png" + "imagine-assets/switchdelegate-handle-checked-hovered@2x.png" + "imagine-assets/switchdelegate-handle-checked.png" + "imagine-assets/switchdelegate-handle-checked@2x.png" + "imagine-assets/switchdelegate-handle-hovered.png" + "imagine-assets/switchdelegate-handle-hovered@2x.png" + "imagine-assets/switchdelegate-handle-pressed.png" + "imagine-assets/switchdelegate-handle-pressed@2x.png" + "imagine-assets/switchdelegate-handle.png" + "imagine-assets/switchdelegate-handle@2x.png" + "imagine-assets/switchdelegate-indicator-pressed.png" + "imagine-assets/switchdelegate-indicator-pressed@2x.png" + "imagine-assets/switchdelegate-indicator.png" + "imagine-assets/switchdelegate-indicator@2x.png" + "imagine-assets/toolseparator-separator-vertical.9.png" + "imagine-assets/toolseparator-separator-vertical@2x.9.png" + "qtquickcontrols2.conf" ) -target_link_libraries(automotive PUBLIC +target_link_libraries(automotiveexample PUBLIC Qt::Core Qt::Gui Qt::Quick Qt::QuickControls2 ) -# Resources: -set(icons_resource_files - "icons/automotive/44x44/air-con.png" - "icons/automotive/44x44/command.png" - "icons/automotive/44x44/message.png" - "icons/automotive/44x44/music.png" - "icons/automotive/44x44/seats.png" - "icons/automotive/44x44/settings.png" - "icons/automotive/44x44/statistics.png" - "icons/automotive/44x44/windows.png" - "icons/automotive/44x44@2/air-con.png" - "icons/automotive/44x44@2/command.png" - "icons/automotive/44x44@2/message.png" - "icons/automotive/44x44@2/music.png" - "icons/automotive/44x44@2/navigation.png" - "icons/automotive/44x44@2/seats.png" - "icons/automotive/44x44@2/settings.png" - "icons/automotive/44x44@2/statistics.png" - "icons/automotive/44x44@2/windows.png" - "icons/automotive/icons.svg" - "icons/automotive/index.theme" - "icons/car.png" - "icons/car@2x.png" - "icons/warning.png" - "icons/warning@2x.png" - "icons/weather.png" - "icons/weather@2x.png" -) - -qt6_add_resources(automotive "icons" - PREFIX - "/icons" - BASE - "icons" - FILES - ${icons_resource_files} -) - -set(imagine-assets_resource_files - "imagine-assets/applicationwindow-background.png" - "imagine-assets/applicationwindow-background@2x.png" - "imagine-assets/button-background-checked-hovered.9.png" - "imagine-assets/button-background-checked-hovered@2x.9.png" - "imagine-assets/button-background-checked.9.png" - "imagine-assets/button-background-checked@2x.9.png" - "imagine-assets/button-background-hovered.9.png" - "imagine-assets/button-background-hovered@2x.9.png" - "imagine-assets/button-background-pressed.9.png" - "imagine-assets/button-background-pressed@2x.9.png" - "imagine-assets/button-background.9.png" - "imagine-assets/button-background@2x.9.png" - "imagine-assets/dial-background-hovered.png" - "imagine-assets/dial-background-hovered@2x.png" - "imagine-assets/dial-background-pressed.png" - "imagine-assets/dial-background-pressed@2x.png" - "imagine-assets/dial-background.png" - "imagine-assets/dial-background@2x.png" - "imagine-assets/dial-handle-pressed.png" - "imagine-assets/dial-handle-pressed@2x.png" - "imagine-assets/dial-handle.png" - "imagine-assets/dial-handle@2x.png" - "imagine-assets/frame-background.9.png" - "imagine-assets/frame-background@2x.9.png" - "imagine-assets/itemdelegate-background-checked.9.png" - "imagine-assets/itemdelegate-background-checked@2x.9.png" - "imagine-assets/itemdelegate-background-hovered.9.png" - "imagine-assets/itemdelegate-background-hovered@2x.9.png" - "imagine-assets/itemdelegate-background-pressed.9.png" - "imagine-assets/itemdelegate-background-pressed@2x.9.png" - "imagine-assets/itemdelegate-background.9.png" - "imagine-assets/itemdelegate-background@2x.9.png" - "imagine-assets/radiobutton-indicator-checked-hovered.png" - "imagine-assets/radiobutton-indicator-checked-hovered@2x.png" - "imagine-assets/radiobutton-indicator-checked-pressed.png" - "imagine-assets/radiobutton-indicator-checked-pressed@2x.png" - "imagine-assets/radiobutton-indicator-checked.png" - "imagine-assets/radiobutton-indicator-checked@2x.png" - "imagine-assets/radiobutton-indicator-hovered.png" - "imagine-assets/radiobutton-indicator-hovered@2x.png" - "imagine-assets/radiobutton-indicator-pressed.png" - "imagine-assets/radiobutton-indicator-pressed@2x.png" - "imagine-assets/radiobutton-indicator.png" - "imagine-assets/radiobutton-indicator@2x.png" - "imagine-assets/scrollindicator-handle.png" - "imagine-assets/scrollindicator-handle@2x.png" - "imagine-assets/slider-background-horizontal.9.png" - "imagine-assets/slider-background-horizontal@2x.9.png" - "imagine-assets/slider-handle-hovered.png" - "imagine-assets/slider-handle-hovered@2x.png" - "imagine-assets/slider-handle-pressed.png" - "imagine-assets/slider-handle-pressed@2x.png" - "imagine-assets/slider-handle.png" - "imagine-assets/slider-handle@2x.png" - "imagine-assets/slider-progress-horizontal-pressed.9.png" - "imagine-assets/slider-progress-horizontal-pressed@2x.9.png" - "imagine-assets/slider-progress-horizontal.9.png" - "imagine-assets/slider-progress-horizontal@2x.9.png" - "imagine-assets/switchdelegate-background.9.png" - "imagine-assets/switchdelegate-background@2x.9.png" - "imagine-assets/switchdelegate-handle-checked-hovered.png" - "imagine-assets/switchdelegate-handle-checked-hovered@2x.png" - "imagine-assets/switchdelegate-handle-checked.png" - "imagine-assets/switchdelegate-handle-checked@2x.png" - "imagine-assets/switchdelegate-handle-hovered.png" - "imagine-assets/switchdelegate-handle-hovered@2x.png" - "imagine-assets/switchdelegate-handle-pressed.png" - "imagine-assets/switchdelegate-handle-pressed@2x.png" - "imagine-assets/switchdelegate-handle.png" - "imagine-assets/switchdelegate-handle@2x.png" - "imagine-assets/switchdelegate-indicator-pressed.png" - "imagine-assets/switchdelegate-indicator-pressed@2x.png" - "imagine-assets/switchdelegate-indicator.png" - "imagine-assets/switchdelegate-indicator@2x.png" - "imagine-assets/toolseparator-separator-vertical.9.png" - "imagine-assets/toolseparator-separator-vertical@2x.9.png" -) - -qt6_add_resources(automotive "imagine-assets" - PREFIX - "/imagine-assets" - BASE - "imagine-assets" - FILES - ${imagine-assets_resource_files} -) - -set(qml_resource_files - "qml/FeatureButton.qml" - "qml/LargeLabel.qml" - "qml/automotive.qml" -) - -qt6_add_resources(automotive "qml" - PREFIX - "/qml" - BASE - "qml" - FILES - ${qml_resource_files} -) - -set(qmake_immediate_resource_files - "qtquickcontrols2.conf" -) - -qt6_add_resources(automotive "qmake_immediate" - PREFIX - "/" - FILES - ${qmake_immediate_resource_files} -) - -install(TARGETS automotive +install(TARGETS automotiveexample RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" diff --git a/examples/quickcontrols2/imagine/musicplayer/CMakeLists.txt b/examples/quickcontrols2/imagine/musicplayer/CMakeLists.txt index 845f35c942..78e436e952 100644 --- a/examples/quickcontrols2/imagine/musicplayer/CMakeLists.txt +++ b/examples/quickcontrols2/imagine/musicplayer/CMakeLists.txt @@ -11,206 +11,174 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/imagine/musicplaye find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick QuickControls2) -qt_add_executable(musicplayer +qt_add_executable(musicplayerexample WIN32 MACOSX_BUNDLE musicplayer.cpp ) -set_target_properties(musicplayer PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE +qt_add_qml_module(musicplayerexample + URI musicplayer + VERSION 1.0 + NO_RESOURCE_TARGET_PATH + QML_FILES + "musicplayer.qml" + RESOURCES + "icons/musicplayer/32x32/bluetooth.png" + "icons/musicplayer/32x32/cart.png" + "icons/musicplayer/32x32/cloud.png" + "icons/musicplayer/32x32/favorite.png" + "icons/musicplayer/32x32/filter.png" + "icons/musicplayer/32x32/folder.png" + "icons/musicplayer/32x32/message.png" + "icons/musicplayer/32x32/music.png" + "icons/musicplayer/32x32/next.png" + "icons/musicplayer/32x32/pause.png" + "icons/musicplayer/32x32/power.png" + "icons/musicplayer/32x32/previous.png" + "icons/musicplayer/32x32/repeat.png" + "icons/musicplayer/32x32/save.png" + "icons/musicplayer/32x32/settings.png" + "icons/musicplayer/32x32/shuffle.png" + "icons/musicplayer/32x32/stop.png" + "icons/musicplayer/32x32@2/bluetooth.png" + "icons/musicplayer/32x32@2/cart.png" + "icons/musicplayer/32x32@2/cloud.png" + "icons/musicplayer/32x32@2/favorite.png" + "icons/musicplayer/32x32@2/filter.png" + "icons/musicplayer/32x32@2/folder.png" + "icons/musicplayer/32x32@2/grid.png" + "icons/musicplayer/32x32@2/message.png" + "icons/musicplayer/32x32@2/music.png" + "icons/musicplayer/32x32@2/next.png" + "icons/musicplayer/32x32@2/pause.png" + "icons/musicplayer/32x32@2/power.png" + "icons/musicplayer/32x32@2/previous.png" + "icons/musicplayer/32x32@2/repeat.png" + "icons/musicplayer/32x32@2/save.png" + "icons/musicplayer/32x32@2/settings.png" + "icons/musicplayer/32x32@2/shuffle.png" + "icons/musicplayer/32x32@2/stop.png" + "icons/musicplayer/index.theme" + "images/album-cover.jpg" + "imagine-assets/applicationwindow-background.png" + "imagine-assets/button-background-checked-hovered.9.png" + "imagine-assets/button-background-checked-hovered@2x.9.png" + "imagine-assets/button-background-checked.9.png" + "imagine-assets/button-background-checked@2x.9.png" + "imagine-assets/button-background-disabled.9.png" + "imagine-assets/button-background-disabled@2x.9.png" + "imagine-assets/button-background-hovered.9.png" + "imagine-assets/button-background-hovered@2x.9.png" + "imagine-assets/button-background-pressed.9.png" + "imagine-assets/button-background-pressed@2x.9.png" + "imagine-assets/button-background.9.png" + "imagine-assets/button-background@2x.9.png" + "imagine-assets/combobox-background-hovered.9.png" + "imagine-assets/combobox-background-hovered@2x.9.png" + "imagine-assets/combobox-background-open.9.png" + "imagine-assets/combobox-background-open@2x.9.png" + "imagine-assets/combobox-background-pressed.9.png" + "imagine-assets/combobox-background-pressed@2x.9.png" + "imagine-assets/combobox-background.9.png" + "imagine-assets/combobox-background@2x.9.png" + "imagine-assets/combobox-indicator-hovered.png" + "imagine-assets/combobox-indicator-hovered@2x.png" + "imagine-assets/combobox-indicator-open.png" + "imagine-assets/combobox-indicator-open@2x.png" + "imagine-assets/combobox-indicator-pressed.png" + "imagine-assets/combobox-indicator-pressed@2x.png" + "imagine-assets/combobox-indicator.png" + "imagine-assets/combobox-indicator@2x.png" + "imagine-assets/combobox-popup.9.png" + "imagine-assets/combobox-popup@2x.9.png" + "imagine-assets/dial-background-hovered.png" + "imagine-assets/dial-background-hovered@2x.png" + "imagine-assets/dial-background-pressed.png" + "imagine-assets/dial-background-pressed@2x.png" + "imagine-assets/dial-background.png" + "imagine-assets/dial-background@2x.png" + "imagine-assets/dial-handle-pressed.png" + "imagine-assets/dial-handle-pressed@2x.png" + "imagine-assets/dial-handle.png" + "imagine-assets/dial-handle@2x.png" + "imagine-assets/frame-background.9.png" + "imagine-assets/frame-background@2x.9.png" + "imagine-assets/itemdelegate-background-checked.9.png" + "imagine-assets/itemdelegate-background-checked@2x.9.png" + "imagine-assets/itemdelegate-background-disabled.9.png" + "imagine-assets/itemdelegate-background-disabled@2x.9.png" + "imagine-assets/itemdelegate-background-hovered.9.png" + "imagine-assets/itemdelegate-background-hovered@2x.9.png" + "imagine-assets/itemdelegate-background-pressed.9.png" + "imagine-assets/itemdelegate-background-pressed@2x.9.png" + "imagine-assets/itemdelegate-background.9.png" + "imagine-assets/itemdelegate-background@2x.9.png" + "imagine-assets/roundbutton-background-checked-hovered.png" + "imagine-assets/roundbutton-background-checked-hovered@2x.png" + "imagine-assets/roundbutton-background-checked.png" + "imagine-assets/roundbutton-background-checked@2x.png" + "imagine-assets/roundbutton-background-disabled.png" + "imagine-assets/roundbutton-background-disabled@2x.png" + "imagine-assets/roundbutton-background-hovered.png" + "imagine-assets/roundbutton-background-hovered@2x.png" + "imagine-assets/roundbutton-background-pressed.png" + "imagine-assets/roundbutton-background-pressed@2x.png" + "imagine-assets/roundbutton-background.png" + "imagine-assets/roundbutton-background@2x.png" + "imagine-assets/scrollbar-handle-interactive-hovered.png" + "imagine-assets/scrollbar-handle-interactive-hovered@2x.png" + "imagine-assets/scrollbar-handle-interactive-pressed.png" + "imagine-assets/scrollbar-handle-interactive-pressed@2x.png" + "imagine-assets/scrollbar-handle-interactive.png" + "imagine-assets/scrollbar-handle-interactive@2x.png" + "imagine-assets/slider-background-horizontal-disabled.9.png" + "imagine-assets/slider-background-horizontal-disabled@2x.9.png" + "imagine-assets/slider-background-horizontal.9.png" + "imagine-assets/slider-background-horizontal@2x.9.png" + "imagine-assets/slider-background-vertical-disabled.9.png" + "imagine-assets/slider-background-vertical-disabled@2x.9.png" + "imagine-assets/slider-background-vertical.9.png" + "imagine-assets/slider-background-vertical@2x.9.png" + "imagine-assets/slider-handle-disabled.png" + "imagine-assets/slider-handle-disabled@2x.png" + "imagine-assets/slider-handle-hovered.png" + "imagine-assets/slider-handle-hovered@2x.png" + "imagine-assets/slider-handle.png" + "imagine-assets/slider-handle@2x.png" + "imagine-assets/slider-progress-horizontal.9.png" + "imagine-assets/slider-progress-horizontal@2x.9.png" + "imagine-assets/slider-progress-vertical-disabled.9.png" + "imagine-assets/slider-progress-vertical-disabled@2x.9.png" + "imagine-assets/slider-progress-vertical.9.png" + "imagine-assets/slider-progress-vertical@2x.9.png" + "imagine-assets/textfield-background-disabled.9.png" + "imagine-assets/textfield-background-disabled@2x.9.png" + "imagine-assets/textfield-background.9.png" + "imagine-assets/textfield-background@2x.9.png" + "imagine-assets/toolbar-background.9.png" + "imagine-assets/toolbar-background@2x.9.png" + "imagine-assets/toolbutton-background-checked-hovered.9.png" + "imagine-assets/toolbutton-background-checked-hovered@2x.9.png" + "imagine-assets/toolbutton-background-checked.9.png" + "imagine-assets/toolbutton-background-checked@2x.9.png" + "imagine-assets/toolbutton-background-hovered.9.png" + "imagine-assets/toolbutton-background-hovered@2x.9.png" + "imagine-assets/toolbutton-background-pressed.9.png" + "imagine-assets/toolbutton-background-pressed@2x.9.png" + "imagine-assets/toolbutton-background.9.png" + "imagine-assets/toolbutton-background@2x.9.png" + "imagine-assets/tooltip-background.9.png" + "imagine-assets/tooltip-background@2x.9.png" + "qtquickcontrols2.conf" ) -target_link_libraries(musicplayer PUBLIC +target_link_libraries(musicplayerexample PUBLIC Qt::Core Qt::Gui Qt::Quick Qt::QuickControls2 ) -# Resources: -set(icons_resource_files - "icons/musicplayer/32x32/bluetooth.png" - "icons/musicplayer/32x32/cart.png" - "icons/musicplayer/32x32/cloud.png" - "icons/musicplayer/32x32/favorite.png" - "icons/musicplayer/32x32/filter.png" - "icons/musicplayer/32x32/folder.png" - "icons/musicplayer/32x32/message.png" - "icons/musicplayer/32x32/music.png" - "icons/musicplayer/32x32/next.png" - "icons/musicplayer/32x32/pause.png" - "icons/musicplayer/32x32/power.png" - "icons/musicplayer/32x32/previous.png" - "icons/musicplayer/32x32/repeat.png" - "icons/musicplayer/32x32/save.png" - "icons/musicplayer/32x32/settings.png" - "icons/musicplayer/32x32/shuffle.png" - "icons/musicplayer/32x32/stop.png" - "icons/musicplayer/32x32@2/bluetooth.png" - "icons/musicplayer/32x32@2/cart.png" - "icons/musicplayer/32x32@2/cloud.png" - "icons/musicplayer/32x32@2/favorite.png" - "icons/musicplayer/32x32@2/filter.png" - "icons/musicplayer/32x32@2/folder.png" - "icons/musicplayer/32x32@2/grid.png" - "icons/musicplayer/32x32@2/message.png" - "icons/musicplayer/32x32@2/music.png" - "icons/musicplayer/32x32@2/next.png" - "icons/musicplayer/32x32@2/pause.png" - "icons/musicplayer/32x32@2/power.png" - "icons/musicplayer/32x32@2/previous.png" - "icons/musicplayer/32x32@2/repeat.png" - "icons/musicplayer/32x32@2/save.png" - "icons/musicplayer/32x32@2/settings.png" - "icons/musicplayer/32x32@2/shuffle.png" - "icons/musicplayer/32x32@2/stop.png" - "icons/musicplayer/index.theme" -) - -qt6_add_resources(musicplayer "icons" - PREFIX - "/icons" - BASE - "icons" - FILES - ${icons_resource_files} -) - -set(imagine-assets_resource_files - "imagine-assets/applicationwindow-background.png" - "imagine-assets/button-background-checked-hovered.9.png" - "imagine-assets/button-background-checked-hovered@2x.9.png" - "imagine-assets/button-background-checked.9.png" - "imagine-assets/button-background-checked@2x.9.png" - "imagine-assets/button-background-disabled.9.png" - "imagine-assets/button-background-disabled@2x.9.png" - "imagine-assets/button-background-hovered.9.png" - "imagine-assets/button-background-hovered@2x.9.png" - "imagine-assets/button-background-pressed.9.png" - "imagine-assets/button-background-pressed@2x.9.png" - "imagine-assets/button-background.9.png" - "imagine-assets/button-background@2x.9.png" - "imagine-assets/combobox-background-hovered.9.png" - "imagine-assets/combobox-background-hovered@2x.9.png" - "imagine-assets/combobox-background-open.9.png" - "imagine-assets/combobox-background-open@2x.9.png" - "imagine-assets/combobox-background-pressed.9.png" - "imagine-assets/combobox-background-pressed@2x.9.png" - "imagine-assets/combobox-background.9.png" - "imagine-assets/combobox-background@2x.9.png" - "imagine-assets/combobox-indicator-hovered.png" - "imagine-assets/combobox-indicator-hovered@2x.png" - "imagine-assets/combobox-indicator-open.png" - "imagine-assets/combobox-indicator-open@2x.png" - "imagine-assets/combobox-indicator-pressed.png" - "imagine-assets/combobox-indicator-pressed@2x.png" - "imagine-assets/combobox-indicator.png" - "imagine-assets/combobox-indicator@2x.png" - "imagine-assets/combobox-popup.9.png" - "imagine-assets/combobox-popup@2x.9.png" - "imagine-assets/dial-background-hovered.png" - "imagine-assets/dial-background-hovered@2x.png" - "imagine-assets/dial-background-pressed.png" - "imagine-assets/dial-background-pressed@2x.png" - "imagine-assets/dial-background.png" - "imagine-assets/dial-background@2x.png" - "imagine-assets/dial-handle-pressed.png" - "imagine-assets/dial-handle-pressed@2x.png" - "imagine-assets/dial-handle.png" - "imagine-assets/dial-handle@2x.png" - "imagine-assets/frame-background.9.png" - "imagine-assets/frame-background@2x.9.png" - "imagine-assets/itemdelegate-background-checked.9.png" - "imagine-assets/itemdelegate-background-checked@2x.9.png" - "imagine-assets/itemdelegate-background-disabled.9.png" - "imagine-assets/itemdelegate-background-disabled@2x.9.png" - "imagine-assets/itemdelegate-background-hovered.9.png" - "imagine-assets/itemdelegate-background-hovered@2x.9.png" - "imagine-assets/itemdelegate-background-pressed.9.png" - "imagine-assets/itemdelegate-background-pressed@2x.9.png" - "imagine-assets/itemdelegate-background.9.png" - "imagine-assets/itemdelegate-background@2x.9.png" - "imagine-assets/roundbutton-background-checked-hovered.png" - "imagine-assets/roundbutton-background-checked-hovered@2x.png" - "imagine-assets/roundbutton-background-checked.png" - "imagine-assets/roundbutton-background-checked@2x.png" - "imagine-assets/roundbutton-background-disabled.png" - "imagine-assets/roundbutton-background-disabled@2x.png" - "imagine-assets/roundbutton-background-hovered.png" - "imagine-assets/roundbutton-background-hovered@2x.png" - "imagine-assets/roundbutton-background-pressed.png" - "imagine-assets/roundbutton-background-pressed@2x.png" - "imagine-assets/roundbutton-background.png" - "imagine-assets/roundbutton-background@2x.png" - "imagine-assets/scrollbar-handle-interactive-hovered.png" - "imagine-assets/scrollbar-handle-interactive-hovered@2x.png" - "imagine-assets/scrollbar-handle-interactive-pressed.png" - "imagine-assets/scrollbar-handle-interactive-pressed@2x.png" - "imagine-assets/scrollbar-handle-interactive.png" - "imagine-assets/scrollbar-handle-interactive@2x.png" - "imagine-assets/slider-background-horizontal-disabled.9.png" - "imagine-assets/slider-background-horizontal-disabled@2x.9.png" - "imagine-assets/slider-background-horizontal.9.png" - "imagine-assets/slider-background-horizontal@2x.9.png" - "imagine-assets/slider-background-vertical-disabled.9.png" - "imagine-assets/slider-background-vertical-disabled@2x.9.png" - "imagine-assets/slider-background-vertical.9.png" - "imagine-assets/slider-background-vertical@2x.9.png" - "imagine-assets/slider-handle-disabled.png" - "imagine-assets/slider-handle-disabled@2x.png" - "imagine-assets/slider-handle-hovered.png" - "imagine-assets/slider-handle-hovered@2x.png" - "imagine-assets/slider-handle.png" - "imagine-assets/slider-handle@2x.png" - "imagine-assets/slider-progress-horizontal.9.png" - "imagine-assets/slider-progress-horizontal@2x.9.png" - "imagine-assets/slider-progress-vertical-disabled.9.png" - "imagine-assets/slider-progress-vertical-disabled@2x.9.png" - "imagine-assets/slider-progress-vertical.9.png" - "imagine-assets/slider-progress-vertical@2x.9.png" - "imagine-assets/textfield-background-disabled.9.png" - "imagine-assets/textfield-background-disabled@2x.9.png" - "imagine-assets/textfield-background.9.png" - "imagine-assets/textfield-background@2x.9.png" - "imagine-assets/toolbar-background.9.png" - "imagine-assets/toolbar-background@2x.9.png" - "imagine-assets/toolbutton-background-checked-hovered.9.png" - "imagine-assets/toolbutton-background-checked-hovered@2x.9.png" - "imagine-assets/toolbutton-background-checked.9.png" - "imagine-assets/toolbutton-background-checked@2x.9.png" - "imagine-assets/toolbutton-background-hovered.9.png" - "imagine-assets/toolbutton-background-hovered@2x.9.png" - "imagine-assets/toolbutton-background-pressed.9.png" - "imagine-assets/toolbutton-background-pressed@2x.9.png" - "imagine-assets/toolbutton-background.9.png" - "imagine-assets/toolbutton-background@2x.9.png" - "imagine-assets/tooltip-background.9.png" - "imagine-assets/tooltip-background@2x.9.png" -) - -qt6_add_resources(musicplayer "imagine-assets" - PREFIX - "/imagine-assets" - BASE - "imagine-assets" - FILES - ${imagine-assets_resource_files} -) - -set(qmake_immediate_resource_files - "images/album-cover.jpg" - "musicplayer.qml" - "qtquickcontrols2.conf" -) - -qt6_add_resources(musicplayer "qmake_immediate" - PREFIX - "/" - FILES - ${qmake_immediate_resource_files} -) - -install(TARGETS musicplayer +install(TARGETS musicplayerexample RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" diff --git a/examples/quickcontrols2/ios/todolist/AppSettings.qml b/examples/quickcontrols2/ios/todolist/AppSettings.qml new file mode 100644 index 0000000000..c732b9fbc8 --- /dev/null +++ b/examples/quickcontrols2/ios/todolist/AppSettings.qml @@ -0,0 +1,14 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +pragma Singleton + +import Qt.labs.settings + +Settings { + // The properties here are given default values to account for the first run of the application. + // After the application has run once, future values will come from the stored settings. + property bool showDoneTasks: true + property int maxTasks: 30 + property int fontSize: 18 +} diff --git a/examples/quickcontrols2/ios/todolist/CMakeLists.txt b/examples/quickcontrols2/ios/todolist/CMakeLists.txt new file mode 100644 index 0000000000..413ea6ad97 --- /dev/null +++ b/examples/quickcontrols2/ios/todolist/CMakeLists.txt @@ -0,0 +1,84 @@ +cmake_minimum_required(VERSION 3.18) +project(todolist LANGUAGES CXX) + +set(CMAKE_AUTOMOC ON) + +if(NOT DEFINED INSTALL_EXAMPLESDIR) + set(INSTALL_EXAMPLESDIR "examples") +endif() + +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/todolist") + +find_package(Qt6 COMPONENTS Gui Qml Quick QuickControls2) + +qt_add_executable(todolist + src/main.cpp +) + +set_target_properties(todolist PROPERTIES + WIN32_EXECUTABLE TRUE + MACOSX_BUNDLE TRUE +) + +target_link_libraries(todolist PUBLIC + Qt${QT_VERSION_MAJOR}::Core + Qt${QT_VERSION_MAJOR}::Gui + Qt${QT_VERSION_MAJOR}::Qml + Qt${QT_VERSION_MAJOR}::Quick + Qt${QT_VERSION_MAJOR}::QuickControls2 +) + +set_source_files_properties(AppSettings.qml PROPERTIES + QT_QML_SINGLETON_TYPE TRUE +) + +set_source_files_properties(Database.qml PROPERTIES + QT_QML_SINGLETON_TYPE TRUE +) + +qt_add_qml_module(todolist + URI App + VERSION 1.0 + QML_FILES + AppSettings.qml + Database.qml + FontSizePage.qml + HomePage.qml + MaxTasksPage.qml + NavBar.qml + ProjectPage.qml + SettingsPage.qml + ToggleCompletedTasksPage.qml + main.qml + RESOURCES + images/back.png + images/back@2x.png + images/back@3x.png + images/back-white.png + images/back-white@2x.png + images/back-white@3x.png + images/close.png + images/close@2x.png + images/close@3x.png + images/close-white.png + images/close-white@2x.png + images/close-white@3x.png + images/plus-math.png + images/plus-math@2x.png + images/plus-math@3x.png + images/settings.png + images/settings@2x.png + images/settings@3x.png + images/add-new.png + images/add-new@2x.png + images/add-new@3x.png + NO_RESOURCE_TARGET_PATH +) + +set_property(GLOBAL PROPERTY XCODE_EMIT_EFFECTIVE_PLATFORM_NAME ON) + +install(TARGETS todolist + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/quickcontrols2/ios/todolist/Database.qml b/examples/quickcontrols2/ios/todolist/Database.qml new file mode 100644 index 0000000000..31bbd8c1e7 --- /dev/null +++ b/examples/quickcontrols2/ios/todolist/Database.qml @@ -0,0 +1,161 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +pragma Singleton + +import QtQml +import QtQuick.LocalStorage + +QtObject { + id: root + + property var _db + + function _database() { + if (_db) + return _db + + try { + let db = LocalStorage.openDatabaseSync("ToDoList", "1.0", "ToDoList application database") + + db.transaction(function (tx) { + tx.executeSql(`CREATE TABLE IF NOT EXISTS projects ( + project_id INTEGER PRIMARY KEY AUTOINCREMENT, + project_name TEXT NOT NULL CHECK(project_name != ''), + project_note TEXT + )`); + }) + + db.transaction(function (tx) { + tx.executeSql(`CREATE TABLE IF NOT EXISTS tasks ( + task_id INTEGER PRIMARY KEY AUTOINCREMENT, + task_name TEXT CHECK(task_name != ''), + done INTEGER, + project_id, + FOREIGN KEY(project_id) REFERENCES projects(project_id) + )`); + }) + + _db = db + } catch (error) { + console.log("Error opening database: " + error) + }; + + return _db + } + + function getProjects() { + let projects = [] + root._database().transaction(function (tx) { + let results = tx.executeSql('SELECT * FROM projects') + for (let i = 0; i < results.rows.length; i++) { + let projectRow = results.rows.item(i) + let projectId = projectRow.project_id + let completedTasks = Math.max(countDoneTasksByProject(projectId).rows.length, 0) + let totalTasks = Math.max(countTaskByProject(projectId).rows.length, 0) + projects.push({ + "projectName": projectRow.project_name, + "projectId": projectId, + "projectNote": projectRow.project_note ?? "", + "completedTasks": completedTasks, + "totalTasks": totalTasks + }) + } + }) + return projects + } + + function newProject(projectName) { + let results + root._database().transaction(function (tx) { + results = tx.executeSql("INSERT INTO projects (project_name) VALUES(?)", [projectName]) + }) + return results + } + + function updateProjectNote(projectId, projectNote) { + root._database().transaction(function (tx) { + tx.executeSql("UPDATE projects set project_note=? WHERE project_id=?", [projectNote, projectId]) + }) + } + + function updateProjectName(projectId, projectName) { + root._database().transaction(function (tx) { + tx.executeSql("UPDATE projects set project_name=? WHERE project_id=?", [projectName, projectId]) + }) + } + + function deleteProject(projectId) { + root._database().transaction(function (tx) { + deleteAllTasks(projectId) + tx.executeSql("DELETE FROM projects WHERE project_id = ?", [projectId]) + }) + } + + function getTaskByProject(projectId) { + if (!projectId) + return + + let tasks = [] + root._database().transaction(function (tx) { + let results = tx.executeSql("SELECT * FROM tasks WHERE project_id = " + [projectId] + " ORDER BY done") + for (let i = 0; i < results.rows.length; i++) { + let row = results.rows.item(i) + tasks.push({ + "taskId": row.task_id, + "taskName": row.task_name, + "done": row.done === 1 ? true : false + }) + } + }) + return tasks + } + + function countTaskByProject(projectId) { + let results + root._database().transaction(function (tx) { + results = tx.executeSql('SELECT task_id FROM tasks WHERE project_id =' + [projectId]) + }) + return results + } + + function countDoneTasksByProject(projectId) { + let results + root._database().transaction(function (tx) { + results = tx.executeSql("SELECT task_id FROM tasks WHERE project_id =" + [projectId] + " AND done = 1") + }) + return results + } + + function newTask(projectId, taskName) { + let results + root._database().transaction(function (tx) { + results = tx.executeSql("INSERT INTO tasks (task_name, done, project_id) VALUES(?, 0, ?)", [taskName, projectId]) + }) + return results + } + + function updateTaskName(taskId, taskName) { + root._database().transaction(function (tx) { + tx.executeSql("UPDATE tasks set task_name=? WHERE task_id=?", [taskName, taskId]) + }) + } + + function updateDoneState(taskId, doneState) { + root._database().transaction(function (tx) { + tx.executeSql("UPDATE tasks set done=? WHERE task_id=?", [doneState, taskId]) + }) + } + + function deleteAllTasks(projectId) { + root._database().transaction(function (tx) { + tx.executeSql("DELETE FROM tasks WHERE project_id =" + projectId) + }) + } + + function deleteTask(taskId) { + root._database().transaction(function (tx) { + tx.executeSql("DELETE FROM tasks WHERE task_id = ?", [taskId]) + }) + } +} diff --git a/examples/quickcontrols2/ios/todolist/FontSizePage.qml b/examples/quickcontrols2/ios/todolist/FontSizePage.qml new file mode 100644 index 0000000000..2b0e5b16db --- /dev/null +++ b/examples/quickcontrols2/ios/todolist/FontSizePage.qml @@ -0,0 +1,44 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +Page { + Frame { + width: parent.width - 60 + anchors.centerIn: parent + topPadding: 12 + bottomPadding: 12 + + RowLayout { + anchors.fill: parent + spacing: 12 + + Label { + text: qsTr("A") + font.pointSize: 15 + font.weight: 400 + } + + Slider { + snapMode: Slider.SnapAlways + stepSize: 1 + from: 15 + value: AppSettings.fontSize + to: 21 + + Layout.fillWidth: true + + onMoved: AppSettings.fontSize = value + } + + Label { + text: qsTr("A") + font.pointSize: 21 + font.weight: 400 + } + } + } +} diff --git a/examples/quickcontrols2/ios/todolist/HomePage.qml b/examples/quickcontrols2/ios/todolist/HomePage.qml new file mode 100644 index 0000000000..3d1b29d1d7 --- /dev/null +++ b/examples/quickcontrols2/ios/todolist/HomePage.qml @@ -0,0 +1,173 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import QtQuick.LocalStorage +import QtQuick.Controls.iOS + +Page { + id: root + + header: Label { + text: qsTr("Projects") + font.pointSize: AppSettings.fontSize + 20 + font.styleName: "Semibold" + leftPadding: 30 + topPadding: 20 + bottomPadding: 20 + } + + ListView { + id: projectListView + anchors.fill: parent + clip: true + + model: ListModel { + id: projectsModel + + Component.onCompleted: { + let projects = Database.getProjects() + for (let project of projects) + append(project) + } + } + + delegate: SwipeDelegate { + id: projectDelegate + width: ListView.view.width + height: projectContent.implicitHeight + + required property int index + required property int projectId + required property string projectName + required property int completedTasks + required property int totalTasks + + swipe.right: Rectangle { + width: 50 + height: parent.height + color: "red" + anchors.right: parent.right + + SwipeDelegate.onClicked: { + Database.deleteProject(projectDelegate.projectId) + projectsModel.remove(projectDelegate.index, 1) + } + + Image { + source: IOS.theme === IOS.Dark ? "images/close-white.png" + : "images/close.png" + width: 20 + height: 20 + anchors.centerIn: parent + } + } + + Column { + id: projectContent + topPadding: 8 + bottomPadding: 10 + leftPadding: 30 + + Label { + text: completedTasks + " / " + totalTasks + font.pointSize: AppSettings.fontSize + } + + Label { + id: project + text: projectName + font.pointSize: AppSettings.fontSize + font.styleName: "Semibold" + } + } + + Connections { + target: projectDelegate + function onClicked() { + let project = projectsModel.get(index) + root.StackView.view.push("ProjectPage.qml", { + "projectsModel": projectsModel, + "projectId": project.projectId, + "projectName": project.projectName, + "projectIndex": index, + "projectNote": project.projectNote, + "completedTasks": project.completedTasks, + "totalTasks": project.totalTasks + }) + } + } + } + } + + Popup { + id: newProjectPopup + anchors.centerIn: parent + height: 200 + modal: true + + ColumnLayout { + anchors.fill: parent + + Label { + text: qsTr("Project Name") + font.pointSize: AppSettings.fontSize + 2.0 + font.bold: true + + Layout.alignment: Qt.AlignHCenter + } + + TextField { + id: newProjectTextField + placeholderText: qsTr("Enter project name") + font.pointSize: AppSettings.fontSize + + Layout.fillWidth: true + Layout.leftMargin: 10 + Layout.rightMargin: 10 + + Keys.onReturnPressed: { + if (createProjectButton.enabled) + createProjectButton.clicked() + } + } + + Button { + id: createProjectButton + text: qsTr("Create project") + flat: true + font.pointSize: AppSettings.fontSize + enabled: newProjectTextField.length > 0 + + Layout.alignment: Qt.AlignHCenter + + onClicked: { + let results = Database.newProject(newProjectTextField.text) + projectsModel.append({ + projectId: parseInt(results.insertId), + projectName: newProjectTextField.text, + totalTasks: 0, + completedTasks: 0, + projectNote: "" + }) + newProjectTextField.text = "" + newProjectPopup.close() + } + } + } + } + + footer: ToolBar { + ToolButton { + anchors.right: parent.right + anchors.rightMargin: 5 + text: qsTr("New project") + font.pointSize: AppSettings.fontSize - 2 + icon.source: "images/add-new.png" + + onClicked: newProjectPopup.open() + } + } +} diff --git a/examples/quickcontrols2/ios/todolist/MaxTasksPage.qml b/examples/quickcontrols2/ios/todolist/MaxTasksPage.qml new file mode 100644 index 0000000000..509a460357 --- /dev/null +++ b/examples/quickcontrols2/ios/todolist/MaxTasksPage.qml @@ -0,0 +1,36 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +Page { + ColumnLayout { + width: parent.width + anchors.verticalCenter: parent.verticalCenter + + Label { + id: maxTasksText + horizontalAlignment: Text.AlignHCenter + wrapMode: Text.Wrap + text: qsTr("Choose the maximum amount of tasks each project can have.") + font.pointSize: AppSettings.fontSize + + Layout.fillWidth: true + } + + SpinBox { + id: maxTasksSpinbox + editable: true + from: 5 + value: AppSettings.maxTasks + to: 30 + + Layout.alignment: Qt.AlignHCenter + Layout.topMargin: 10 + + onValueModified: AppSettings.maxTasks = maxTasksSpinbox.value + } + } +} diff --git a/examples/quickcontrols2/ios/todolist/NavBar.qml b/examples/quickcontrols2/ios/todolist/NavBar.qml new file mode 100644 index 0000000000..4f57353dca --- /dev/null +++ b/examples/quickcontrols2/ios/todolist/NavBar.qml @@ -0,0 +1,44 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +import QtQuick +import QtQuick.Controls + +ToolBar { + id: root + width: parent.width + + required property StackView stackView + + ToolButton { + enabled: root.stackView.depth >= 2 + anchors.left: parent.left + anchors.leftMargin: 5 + visible: root.stackView.depth >= 2 + anchors.verticalCenter: parent.verticalCenter + display: AbstractButton.TextBesideIcon + text: root.stackView.depth > 2 ? qsTr("Back") : qsTr("Home") + font.pointSize: AppSettings.fontSize + icon.source: "images/back.png" + icon.height: 20 + icon.width: 20 + + onClicked: root.stackView.pop() + } + + ToolButton { + anchors.right: parent.right + anchors.rightMargin: 5 + icon.source: "images/settings.png" + icon.height: 20 + icon.width: 20 + visible: { + // Force the binding to re-evaluate so that the title check is run each time the page changes. + root.stackView.currentItem + !root.stackView.find((item, index) => { return item.title === "settingsPage" }) + } + + onClicked: root.stackView.push("SettingsPage.qml") + } +} + diff --git a/examples/quickcontrols2/ios/todolist/ProjectPage.qml b/examples/quickcontrols2/ios/todolist/ProjectPage.qml new file mode 100644 index 0000000000..fd33e73980 --- /dev/null +++ b/examples/quickcontrols2/ios/todolist/ProjectPage.qml @@ -0,0 +1,256 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import QtQuick.Controls.iOS + +Page { + id: root + + required property int projectIndex + required property int projectId + required property string projectName + required property string projectNote + + required property int completedTasks + required property int totalTasks + + required property ListModel projectsModel + + header: ColumnLayout { + id: titleRow + spacing: 4 + + TextField { + id: projectNameLabel + Layout.fillWidth: true + text: root.projectName + font.pointSize: AppSettings.fontSize + 10 + font.styleName: "Bold" + padding: 0 + background: null + wrapMode: TextField.Wrap + + Layout.topMargin: 10 + Layout.leftMargin: 20 + Layout.rightMargin: 20 + + onEditingFinished: { + Database.updateProjectName(root.projectId, text) + projectsModel.setProperty(projectIndex, "projectName", projectNameLabel.text) + } + } + + Label { + text: root.completedTasks + " / " + root.totalTasks + Layout.leftMargin: 20 + } + + ProgressBar { + id: progressBar + from: 0 + value: root.completedTasks + to: root.totalTasks + Layout.leftMargin: 20 + } + } + + ColumnLayout { + anchors.fill: parent + + TextArea { + id: textArea + leftPadding: 15 + rightPadding: doneButton.width + bottomPadding: 10 + topPadding: 10 + font.pointSize: AppSettings.fontSize + placeholderText: qsTr("Write a note...") + text: root.projectNote + wrapMode: TextArea.Wrap + clip: true + + Layout.fillWidth: true + Layout.preferredHeight: 80 + Layout.topMargin: 20 + + onEditingFinished: { + Database.updateProjectNote(root.projectId, text) + projectsModel.setProperty(projectIndex, "projectNote", textArea.text) + } + + Button { + id: doneButton + text: qsTr("Done") + flat: true + visible: textArea.focus + onClicked: textArea.editingFinished() + anchors.right: parent.right + anchors.bottom: parent.bottom + } + } + + ListView { + id: taskListView + model: taskModel + clip: true + + Layout.fillWidth: true + Layout.fillHeight: true + Layout.topMargin: 20 + + ListModel { + id: taskModel + + Component.onCompleted: { + let tasks = Database.getTaskByProject(projectId) + for (let task of tasks) + append(task) + } + } + + delegate: CheckDelegate { + id: taskList + width: taskListView.width + height: visible ? 40 : 0 + checked: done + visible: !done || (done && AppSettings.showDoneTasks) + + required property bool done + required property int taskId + required property string taskName + required property int index + + onClicked: { + Database.updateDoneState(taskId, checked ? 1 : 0) + taskModel.setProperty(index, "done", checked) + root.completedTasks = Math.max(Database.countDoneTasksByProject(root.projectId).rows.length, 0) + root.totalTasks = Math.max(Database.countTaskByProject(root.projectId).rows.length, 0) + root.projectsModel.setProperty(projectIndex, "completedTasks", root.completedTasks) + } + + TextField { + id: taskNameLabel + text: taskList.taskName + anchors.left: deleteTaskButton.right + anchors.leftMargin: 10 + padding: 0 + font.pointSize: AppSettings.fontSize + anchors.verticalCenter: parent.verticalCenter + background: null + + onEditingFinished: { + Database.updateTaskName(taskList.taskId, taskNameLabel.text) + taskModel.setProperty(index, "taskName", taskNameLabel.text) + } + } + + Button { + id: deleteTaskButton + anchors.left: parent.left + width: 15 + height: 15 + flat: true + topPadding: 0 + bottomPadding: 0 + rightPadding: 0 + leftPadding: 0 + anchors.leftMargin: 10 + anchors.verticalCenter: parent.verticalCenter + icon.source: "images/close.png" + icon.color: IOS.theme === IOS.Dark ? "white" : "black" + + onClicked: { + Database.deleteTask(taskList.taskId) + taskModel.remove(index, 1) + root.totalTasks-- + if (taskList.done) + root.completedTasks-- + } + } + } + } + + Popup { + id: addTaskPopup + parent: root + anchors.centerIn: parent + height: 200 + modal: true + focus: true + + ColumnLayout { + anchors.fill: parent + + Label { + text: qsTr("Add New Task") + font.pointSize: AppSettings.fontSize + 2.0 + font.bold: true + + Layout.alignment: Qt.AlignHCenter + } + + TextField { + id: newTaskNameTextField + placeholderText: qsTr("Enter task name") + font.pointSize: AppSettings.fontSize + + Keys.onReturnPressed: { + if (addTaskButton.enabled) + addTaskButton.clicked() + } + + Layout.fillWidth: true + Layout.leftMargin: 10 + Layout.rightMargin: 10 + Layout.alignment: Qt.AlignHCenter + } + + Button { + id: addTaskButton + text: qsTr("Add task") + flat: true + font.pointSize: AppSettings.fontSize + enabled: newTaskNameTextField.length > 0 + + Layout.alignment: Qt.AlignHCenter + + onClicked: { + const result = Database.newTask(root.projectId, newTaskNameTextField.text) + taskModel.append({ + "taskId": parseInt(result.insertId), + "taskName": newTaskNameTextField.text, "done": false + }) + root.projectsModel.setProperty(projectIndex, "totalTasks", taskListView.count) + newTaskNameTextField.text = "" + root.totalTasks++ + addTaskPopup.close() + } + } + } + } + + Label { + text: qsTr("Task limit reached.") + Layout.alignment: Qt.AlignHCenter + Layout.bottomMargin: 20 + font.pointSize: AppSettings.fontSize + visible: taskListView.count >= AppSettings.maxTasks + } + } + + footer: ToolBar { + ToolButton { + anchors.right: parent.right + anchors.rightMargin: 5 + text: qsTr("New task") + font.pointSize: AppSettings.fontSize - 2 + icon.source: "images/add-new.png" + enabled: taskListView.count < AppSettings.maxTasks + + onClicked: addTaskPopup.open() + } + } +} diff --git a/examples/quickcontrols2/ios/todolist/SettingsPage.qml b/examples/quickcontrols2/ios/todolist/SettingsPage.qml new file mode 100644 index 0000000000..85e8ed2125 --- /dev/null +++ b/examples/quickcontrols2/ios/todolist/SettingsPage.qml @@ -0,0 +1,68 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +import QtQuick +import QtQuick.Controls +import QtQuick.Controls.iOS + +Page { + title: "settingsPage" + + property bool showDoneTasks: true + + header: Label { + text: qsTr("Settings") + font.pointSize: AppSettings.fontSize + 20 + font.styleName: "Semibold" + leftPadding: 20 + topPadding: 20 + } + + ListView { + anchors.fill: parent + topMargin: 20 + model: listModel + clip: true + + ListModel { + id: listModel + ListElement { + setting: qsTr("Font size") + page: "FontSize" + } + + ListElement { + setting: qsTr("Maximum number of tasks per project") + page: "MaxTasks" + } + + ListElement { + setting: qsTr("Show completed tasks") + page: "ToggleCompletedTasks" + } + } + + delegate: ItemDelegate { + width: parent.width + text: setting + font.pointSize: AppSettings.fontSize + + onClicked: stackView.push(page + "Page.qml") + + required property string setting + required property string page + + Image { + source: IOS.theme === IOS.Dark ? "images/back-white.png" + : "images/back.png" + width: 20 + height: 20 + anchors.right: parent.right + anchors.rightMargin: 10 + fillMode: Image.PreserveAspectFit + anchors.verticalCenter: parent.verticalCenter + mirror: true + } + } + } +} diff --git a/examples/quickcontrols2/ios/todolist/ToggleCompletedTasksPage.qml b/examples/quickcontrols2/ios/todolist/ToggleCompletedTasksPage.qml new file mode 100644 index 0000000000..df2145866a --- /dev/null +++ b/examples/quickcontrols2/ios/todolist/ToggleCompletedTasksPage.qml @@ -0,0 +1,34 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +Page { + ColumnLayout { + width: parent.width + anchors.verticalCenter: parent.verticalCenter + + Label { + id: toggleText + horizontalAlignment: Text.AlignHCenter + wrapMode: Text.Wrap + text: toggleTasksSwitch.checked ? qsTr("Completed tasks will be shown.") + : qsTr("Completed tasks will be hidden.") + font.pointSize: AppSettings.fontSize + + Layout.fillWidth: true + } + + Switch { + id: toggleTasksSwitch + checked: AppSettings.showDoneTasks + + Layout.alignment: Qt.AlignHCenter + Layout.topMargin: 10 + + onClicked: AppSettings.showDoneTasks = checked + } + } +} diff --git a/examples/quickcontrols2/ios/todolist/doc/images/qtquickcontrols2-todolist.png b/examples/quickcontrols2/ios/todolist/doc/images/qtquickcontrols2-todolist.png Binary files differnew file mode 100644 index 0000000000..5be7190a43 --- /dev/null +++ b/examples/quickcontrols2/ios/todolist/doc/images/qtquickcontrols2-todolist.png diff --git a/examples/quickcontrols2/ios/todolist/doc/src/qtquickcontrols2-todolist.qdoc b/examples/quickcontrols2/ios/todolist/doc/src/qtquickcontrols2-todolist.qdoc new file mode 100644 index 0000000000..12e2d4fca5 --- /dev/null +++ b/examples/quickcontrols2/ios/todolist/doc/src/qtquickcontrols2-todolist.qdoc @@ -0,0 +1,22 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only + +/*! + \example ios/todolist + \keyword Qt Quick Controls - To Do List + \title Qt Quick Controls - To Do List + \keyword Qt Quick Controls 2 - To Do List + \ingroup qtquickcontrols2-examples + \brief To do list application for iOS. + + This example demonstrates how to create a simple to do list application for + iOS using the \l {iOS Style}. + + \image qtquickcontrols2-todolist.png + + The example also shows how an in-memory SQL database can be created and + used purely through QML, without needing C++, through the use of + \l {Qt Quick Local Storage QML Types}{LocalStorage}. + + \include examples-run.qdocinc +*/ diff --git a/examples/quickcontrols2/ios/todolist/images/add-new.png b/examples/quickcontrols2/ios/todolist/images/add-new.png Binary files differnew file mode 100644 index 0000000000..2e60e48a2d --- /dev/null +++ b/examples/quickcontrols2/ios/todolist/images/add-new.png diff --git a/examples/quickcontrols2/ios/todolist/images/add-new@2x.png b/examples/quickcontrols2/ios/todolist/images/add-new@2x.png Binary files differnew file mode 100644 index 0000000000..edb8b62847 --- /dev/null +++ b/examples/quickcontrols2/ios/todolist/images/add-new@2x.png diff --git a/examples/quickcontrols2/ios/todolist/images/add-new@3x.png b/examples/quickcontrols2/ios/todolist/images/add-new@3x.png Binary files differnew file mode 100644 index 0000000000..b5b9b6a5d6 --- /dev/null +++ b/examples/quickcontrols2/ios/todolist/images/add-new@3x.png diff --git a/examples/quickcontrols2/ios/todolist/images/back-white.png b/examples/quickcontrols2/ios/todolist/images/back-white.png Binary files differnew file mode 100644 index 0000000000..503bdf4d48 --- /dev/null +++ b/examples/quickcontrols2/ios/todolist/images/back-white.png diff --git a/examples/quickcontrols2/ios/todolist/images/back-white@2x.png b/examples/quickcontrols2/ios/todolist/images/back-white@2x.png Binary files differnew file mode 100644 index 0000000000..e201ec6d5b --- /dev/null +++ b/examples/quickcontrols2/ios/todolist/images/back-white@2x.png diff --git a/examples/quickcontrols2/ios/todolist/images/back-white@3x.png b/examples/quickcontrols2/ios/todolist/images/back-white@3x.png Binary files differnew file mode 100644 index 0000000000..eb8b7ffc68 --- /dev/null +++ b/examples/quickcontrols2/ios/todolist/images/back-white@3x.png diff --git a/examples/quickcontrols2/ios/todolist/images/back.png b/examples/quickcontrols2/ios/todolist/images/back.png Binary files differnew file mode 100644 index 0000000000..94580efd7f --- /dev/null +++ b/examples/quickcontrols2/ios/todolist/images/back.png diff --git a/examples/quickcontrols2/ios/todolist/images/back@2x.png b/examples/quickcontrols2/ios/todolist/images/back@2x.png Binary files differnew file mode 100644 index 0000000000..b5cf424e91 --- /dev/null +++ b/examples/quickcontrols2/ios/todolist/images/back@2x.png diff --git a/examples/quickcontrols2/ios/todolist/images/back@3x.png b/examples/quickcontrols2/ios/todolist/images/back@3x.png Binary files differnew file mode 100644 index 0000000000..50d5102f4e --- /dev/null +++ b/examples/quickcontrols2/ios/todolist/images/back@3x.png diff --git a/examples/quickcontrols2/ios/todolist/images/close-white.png b/examples/quickcontrols2/ios/todolist/images/close-white.png Binary files differnew file mode 100644 index 0000000000..72163067a6 --- /dev/null +++ b/examples/quickcontrols2/ios/todolist/images/close-white.png diff --git a/examples/quickcontrols2/ios/todolist/images/close-white@2x.png b/examples/quickcontrols2/ios/todolist/images/close-white@2x.png Binary files differnew file mode 100644 index 0000000000..54828e84d1 --- /dev/null +++ b/examples/quickcontrols2/ios/todolist/images/close-white@2x.png diff --git a/examples/quickcontrols2/ios/todolist/images/close-white@3x.png b/examples/quickcontrols2/ios/todolist/images/close-white@3x.png Binary files differnew file mode 100644 index 0000000000..dd67cf1b69 --- /dev/null +++ b/examples/quickcontrols2/ios/todolist/images/close-white@3x.png diff --git a/examples/quickcontrols2/ios/todolist/images/close.png b/examples/quickcontrols2/ios/todolist/images/close.png Binary files differnew file mode 100644 index 0000000000..eba32b637d --- /dev/null +++ b/examples/quickcontrols2/ios/todolist/images/close.png diff --git a/examples/quickcontrols2/ios/todolist/images/close@2x.png b/examples/quickcontrols2/ios/todolist/images/close@2x.png Binary files differnew file mode 100644 index 0000000000..72cf76317a --- /dev/null +++ b/examples/quickcontrols2/ios/todolist/images/close@2x.png diff --git a/examples/quickcontrols2/ios/todolist/images/close@3x.png b/examples/quickcontrols2/ios/todolist/images/close@3x.png Binary files differnew file mode 100644 index 0000000000..6cb2ea58d9 --- /dev/null +++ b/examples/quickcontrols2/ios/todolist/images/close@3x.png diff --git a/examples/quickcontrols2/ios/todolist/images/plus-math.png b/examples/quickcontrols2/ios/todolist/images/plus-math.png Binary files differnew file mode 100644 index 0000000000..b0d182d23e --- /dev/null +++ b/examples/quickcontrols2/ios/todolist/images/plus-math.png diff --git a/examples/quickcontrols2/ios/todolist/images/plus-math@2x.png b/examples/quickcontrols2/ios/todolist/images/plus-math@2x.png Binary files differnew file mode 100644 index 0000000000..112a132084 --- /dev/null +++ b/examples/quickcontrols2/ios/todolist/images/plus-math@2x.png diff --git a/examples/quickcontrols2/ios/todolist/images/plus-math@3x.png b/examples/quickcontrols2/ios/todolist/images/plus-math@3x.png Binary files differnew file mode 100644 index 0000000000..ca513d200b --- /dev/null +++ b/examples/quickcontrols2/ios/todolist/images/plus-math@3x.png diff --git a/examples/quickcontrols2/ios/todolist/images/settings.png b/examples/quickcontrols2/ios/todolist/images/settings.png Binary files differnew file mode 100644 index 0000000000..600981fb35 --- /dev/null +++ b/examples/quickcontrols2/ios/todolist/images/settings.png diff --git a/examples/quickcontrols2/ios/todolist/images/settings@2x.png b/examples/quickcontrols2/ios/todolist/images/settings@2x.png Binary files differnew file mode 100644 index 0000000000..80541aa028 --- /dev/null +++ b/examples/quickcontrols2/ios/todolist/images/settings@2x.png diff --git a/examples/quickcontrols2/ios/todolist/images/settings@3x.png b/examples/quickcontrols2/ios/todolist/images/settings@3x.png Binary files differnew file mode 100644 index 0000000000..48c2b2a8c0 --- /dev/null +++ b/examples/quickcontrols2/ios/todolist/images/settings@3x.png diff --git a/examples/quickcontrols2/ios/todolist/main.qml b/examples/quickcontrols2/ios/todolist/main.qml new file mode 100644 index 0000000000..a0067643f1 --- /dev/null +++ b/examples/quickcontrols2/ios/todolist/main.qml @@ -0,0 +1,32 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +import QtQuick +import QtQuick.Window +import QtQuick.Controls + +ApplicationWindow { + width: 390 + height: 844 + visible: true + title: "To Do List" + + header: NavBar { + stackView: stackView + } + + Flickable { + width: parent.width + height: parent.height + flickableDirection: Flickable.VerticalFlick + boundsBehavior: Flickable.StopAtBounds + + ScrollIndicator.vertical: ScrollIndicator {} + + StackView { + id: stackView + anchors.fill: parent + initialItem: HomePage {} + } + } +} diff --git a/examples/quickcontrols2/ios/todolist/qmldir b/examples/quickcontrols2/ios/todolist/qmldir new file mode 100644 index 0000000000..e0c443110e --- /dev/null +++ b/examples/quickcontrols2/ios/todolist/qmldir @@ -0,0 +1,2 @@ +singleton Database 1.0 Database.qml +singleton AppSettings 1.0 AppSettings.qml diff --git a/examples/quickcontrols2/ios/todolist/src/main.cpp b/examples/quickcontrols2/ios/todolist/src/main.cpp new file mode 100644 index 0000000000..1db4f7ae37 --- /dev/null +++ b/examples/quickcontrols2/ios/todolist/src/main.cpp @@ -0,0 +1,32 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include <QGuiApplication> +#include <QQmlApplicationEngine> +#include <QtQml/qqmlextensionplugin.h> +#include <QtQuickControls2/qquickstyle.h> + +int main(int argc, char *argv[]) +{ + QGuiApplication app(argc, argv); + + QQuickStyle::setStyle("iOS"); + + QQmlApplicationEngine engine; + const QUrl url(u"qrc:/main.qml"_qs); + QObject::connect( + &engine, &QQmlApplicationEngine::objectCreated, &app, + [url](QObject *obj, const QUrl &objUrl) { + if (!obj && url == objUrl) + QCoreApplication::exit(-1); + }, + Qt::QueuedConnection); + + engine.addImportPath(":/"); + + engine.load(url); + if (engine.rootObjects().isEmpty()) + return -1; + + return app.exec(); +} diff --git a/examples/quickcontrols2/ios/todolist/todolist.pro b/examples/quickcontrols2/ios/todolist/todolist.pro new file mode 100644 index 0000000000..d77d718a62 --- /dev/null +++ b/examples/quickcontrols2/ios/todolist/todolist.pro @@ -0,0 +1,42 @@ +TEMPLATE = app +TARGET = todolist +QT += quick quickcontrols2 + +SOURCES += src/main.cpp + +RESOURCES += \ + images/back.png \ + images/back@2x.png \ + images/back@3x.png \ + images/back-white.png \ + images/back-white@2x.png \ + images/back-white@3x.png \ + images/close.png \ + images/close@2x.png \ + images/close@3x.png \ + images/close-white.png \ + images/close-white@2x.png \ + images/close-white@3x.png \ + images/plus-math.png \ + images/plus-math@2x.png \ + images/plus-math@3x.png \ + images/settings.png \ + images/settings@2x.png \ + images/settings@3x.png \ + images/add-new.png \ + images/add-new@2x.png \ + images/add-new@3x.png \ + main.qml \ + AppSettings.qml \ + Database.qml \ + FontSizePage.qml \ + HomePage.qml \ + MaxTasksPage.qml \ + NavBar.qml \ + ProjectPage.qml \ + SettingsPage.qml \ + ToggleCompletedTasksPage.qml \ + qmldir + +target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols2/ios/todolist +INSTALLS += target diff --git a/examples/quickcontrols2/sidepanel/CMakeLists.txt b/examples/quickcontrols2/sidepanel/CMakeLists.txt index 0e94bca5fb..e61bc46538 100644 --- a/examples/quickcontrols2/sidepanel/CMakeLists.txt +++ b/examples/quickcontrols2/sidepanel/CMakeLists.txt @@ -11,41 +11,33 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/sidepanel") find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick) -qt_add_executable(sidepanel +qt_add_executable(sidepanelexample WIN32 MACOSX_BUNDLE sidepanel.cpp ) -set_target_properties(sidepanel PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE +qt_add_qml_module(sidepanelexample + URI sidepanel + VERSION 1.0 + NO_RESOURCE_TARGET_PATH + QML_FILES + "sidepanel.qml" + RESOURCES + "images/qt-logo.png" + "images/qt-logo@2x.png" + "images/qt-logo@3x.png" + "images/qt-logo@4x.png" + "qtquickcontrols2.conf" + "doc/images/qtquickcontrols2-sidepanel-landscape.png" + "doc/images/qtquickcontrols2-sidepanel-portrait.png" ) -target_link_libraries(sidepanel PUBLIC +target_link_libraries(sidepanelexample PUBLIC Qt::Core Qt::Gui Qt::Quick ) -# Resources: -set(qmake_immediate_resource_files - "doc/images/qtquickcontrols2-sidepanel-landscape.png" - "doc/images/qtquickcontrols2-sidepanel-portrait.png" - "images/qt-logo.png" - "images/qt-logo@2x.png" - "images/qt-logo@3x.png" - "images/qt-logo@4x.png" - "qtquickcontrols2.conf" - "sidepanel.qml" -) - -qt6_add_resources(sidepanel "qmake_immediate" - PREFIX - "/" - FILES - ${qmake_immediate_resource_files} -) - -install(TARGETS sidepanel +install(TARGETS sidepanelexample RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" diff --git a/examples/quickcontrols2/swipetoremove/CMakeLists.txt b/examples/quickcontrols2/swipetoremove/CMakeLists.txt index 66862b9171..8b3c1578c9 100644 --- a/examples/quickcontrols2/swipetoremove/CMakeLists.txt +++ b/examples/quickcontrols2/swipetoremove/CMakeLists.txt @@ -4,42 +4,34 @@ project(swipetoremove LANGUAGES CXX) set(CMAKE_AUTOMOC ON) if(NOT DEFINED INSTALL_EXAMPLESDIR) - set(INSTALL_EXAMPLESDIR "examples") + set(INSTALL_EXAMPLESDIR "examples") endif() set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/swipetoremove") find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml) -qt_add_executable(swipetoremove +qt_add_executable(swipetoremoveexample WIN32 MACOSX_BUNDLE swipetoremove.cpp ) - -set_target_properties(swipetoremove PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE -) - -target_link_libraries(swipetoremove PUBLIC +target_link_libraries(swipetoremoveexample PUBLIC Qt::Core Qt::Gui Qt::Qml ) # Resources: -set(qmake_immediate_resource_files - "fonts/fontello.ttf" - "swipetoremove.qml" -) - -qt6_add_resources(swipetoremove "qmake_immediate" - PREFIX - "/" - FILES - ${qmake_immediate_resource_files} +qt_add_qml_module(swipetoremoveexample + URI swipetoremove + VERSION 1.0 + NO_RESOURCE_TARGET_PATH + QML_FILES + "swipetoremove.qml" + RESOURCES + "fonts/fontello.ttf" ) -install(TARGETS swipetoremove +install(TARGETS swipetoremoveexample RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" diff --git a/examples/quickcontrols2/swipetoremove/swipetoremove.pro b/examples/quickcontrols2/swipetoremove/swipetoremove.pro index 8e6bd5f663..bcdb45cd45 100644 --- a/examples/quickcontrols2/swipetoremove/swipetoremove.pro +++ b/examples/quickcontrols2/swipetoremove/swipetoremove.pro @@ -2,12 +2,9 @@ TEMPLATE = app TARGET = swipetoremove QT += qml -SOURCES += \ - swipetoremove.cpp +SOURCES += swipetoremove.cpp -RESOURCES += \ - swipetoremove.qml \ - fonts/fontello.ttf +RESOURCES += swipetoremove.qml target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols2/swipetoremove INSTALLS += target diff --git a/examples/quickcontrols2/texteditor/CMakeLists.txt b/examples/quickcontrols2/texteditor/CMakeLists.txt index 52851f1b9b..82bf3c31cf 100644 --- a/examples/quickcontrols2/texteditor/CMakeLists.txt +++ b/examples/quickcontrols2/texteditor/CMakeLists.txt @@ -11,49 +11,45 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/texteditor") find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick QuickControls2 OPTIONAL_COMPONENTS Widgets) -qt_add_executable(texteditor WIN32 MACOSX_BUNDLE +qt_add_executable(texteditorexample WIN32 MACOSX_BUNDLE documenthandler.cpp texteditor.cpp ) -target_link_libraries(texteditor PUBLIC +qt_add_qml_module(texteditorexample + URI texteditor + VERSION 1.0 + NO_RESOURCE_TARGET_PATH + QML_FILES + "qml/+touch/texteditor.qml" + "qml/texteditor.qml" + RESOURCES + "texteditor.html" + "+touch/texteditor.html" + "fonts/fontello.ttf" + "images/qt-logo.png" +) + +target_link_libraries(texteditorexample PUBLIC Qt::Core Qt::Gui Qt::Quick Qt::QuickControls2 ) -# Resources: -set(texteditor_resource_files - "+touch/texteditor.html" - "fonts/fontello.ttf" - "images/qt-logo.png" - "qml/+touch/texteditor.qml" - "qml/texteditor.qml" - "qtquickcontrols2.conf" - "texteditor.html" -) - -qt6_add_resources(texteditor "texteditor" - PREFIX - "/" - FILES - ${texteditor_resource_files} -) - if(TARGET Qt::Widgets) - target_link_libraries(texteditor PUBLIC + target_link_libraries(texteditorexample PUBLIC Qt::Widgets ) endif() if(CMAKE_CROSSCOMPILING) - target_compile_definitions(texteditor PUBLIC + target_compile_definitions(texteditorexample PUBLIC QT_EXTRA_FILE_SELECTOR="touch" ) endif() -install(TARGETS texteditor +install(TARGETS texteditorexample RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" diff --git a/examples/quickcontrols2/texteditor/documenthandler.cpp b/examples/quickcontrols2/texteditor/documenthandler.cpp index a3a26f1ad4..9571aa03ba 100644 --- a/examples/quickcontrols2/texteditor/documenthandler.cpp +++ b/examples/quickcontrols2/texteditor/documenthandler.cpp @@ -276,4 +276,73 @@ void DocumentHandler::setFont(const QFont & font){ emit fontChanged(); } +bool DocumentHandler::bold() const +{ + const QTextCursor cursor = textCursor(); + if (cursor.isNull()) + return m_document->textDocument()->defaultFont().bold(); + return cursor.charFormat().font().bold(); +} + +void DocumentHandler::setBold(bool bold) +{ + const QTextCursor cursor = textCursor(); + if (!cursor.isNull() && cursor.charFormat().font().bold() == bold) + return; + + QFont font = cursor.charFormat().font(); + font.setBold(bold); + QTextCharFormat format; + format.setFont(font); + mergeFormatOnWordOrSelection(format); + + emit boldChanged(); +} + +bool DocumentHandler::underline() const +{ + const QTextCursor cursor = textCursor(); + if (cursor.isNull()) + return m_document->textDocument()->defaultFont().underline(); + return cursor.charFormat().font().underline(); +} + +void DocumentHandler::setUnderline(bool underline) +{ + const QTextCursor cursor = textCursor(); + if (!cursor.isNull() && cursor.charFormat().font().underline() == underline) + return; + + QFont font = cursor.charFormat().font(); + font.setUnderline(underline); + QTextCharFormat format; + format.setFont(font); + mergeFormatOnWordOrSelection(format); + + emit underlineChanged(); +} + +bool DocumentHandler::italic() const +{ + const QTextCursor cursor = textCursor(); + if (cursor.isNull()) + return m_document->textDocument()->defaultFont().italic(); + return cursor.charFormat().font().italic(); +} + +void DocumentHandler::setItalic(bool italic) +{ + const QTextCursor cursor = textCursor(); + if (!cursor.isNull() && cursor.charFormat().font().italic() == italic) + return; + + QFont font = cursor.charFormat().font(); + font.setItalic(italic); + QTextCharFormat format; + format.setFont(font); + mergeFormatOnWordOrSelection(format); + + emit italicChanged(); +} + #include "moc_documenthandler.cpp" diff --git a/examples/quickcontrols2/texteditor/documenthandler.h b/examples/quickcontrols2/texteditor/documenthandler.h index c993748a5f..b750997885 100644 --- a/examples/quickcontrols2/texteditor/documenthandler.h +++ b/examples/quickcontrols2/texteditor/documenthandler.h @@ -28,6 +28,10 @@ class DocumentHandler : public QObject Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged) + Q_PROPERTY(bool bold READ bold WRITE setBold NOTIFY boldChanged) + Q_PROPERTY(bool underline READ underline WRITE setUnderline NOTIFY underlineChanged) + Q_PROPERTY(bool italic READ italic WRITE setItalic NOTIFY italicChanged) + Q_PROPERTY(QString fileName READ fileName NOTIFY fileUrlChanged) Q_PROPERTY(QString fileType READ fileType NOTIFY fileUrlChanged) Q_PROPERTY(QUrl fileUrl READ fileUrl NOTIFY fileUrlChanged) @@ -58,6 +62,15 @@ public: QFont font() const; void setFont(const QFont & font); + bool bold() const; + void setBold(bool bold); + + bool underline() const; + void setUnderline(bool underline); + + bool italic() const; + void setItalic(bool italic); + QString fileName() const; QString fileType() const; QUrl fileUrl() const; @@ -76,6 +89,9 @@ Q_SIGNALS: void selectionEndChanged(); void fontChanged(); + void boldChanged(); + void underlineChanged(); + void italicChanged(); void textColorChanged(); void alignmentChanged(); diff --git a/examples/quickcontrols2/texteditor/qml/+touch/texteditor.qml b/examples/quickcontrols2/texteditor/qml/+touch/texteditor.qml index debc5bfa30..2a0d9f117f 100644 --- a/examples/quickcontrols2/texteditor/qml/+touch/texteditor.qml +++ b/examples/quickcontrols2/texteditor/qml/+touch/texteditor.qml @@ -102,9 +102,6 @@ ApplicationWindow { footer: ToolBar { visible: !textArea.readOnly && textArea.activeFocus - Material.primary: "#E0E0E0" - Material.elevation: 0 - Flickable { anchors.fill: parent contentWidth: toolRow.implicitWidth diff --git a/examples/quickcontrols2/texteditor/qml/texteditor.qml b/examples/quickcontrols2/texteditor/qml/texteditor.qml index 205dde520e..decf0801e4 100644 --- a/examples/quickcontrols2/texteditor/qml/texteditor.qml +++ b/examples/quickcontrols2/texteditor/qml/texteditor.qml @@ -153,7 +153,7 @@ ApplicationWindow { selectedNameFilter.index: 1 nameFilters: ["Text files (*.txt)", "HTML files (*.html *.htm)", "Markdown files (*.md *.markdown)"] currentFolder: StandardPaths.writableLocation(StandardPaths.DocumentsLocation) - onAccepted: document.load(file) + onAccepted: document.load(selectedFile) } FileDialog { @@ -168,14 +168,13 @@ ApplicationWindow { FontDialog { id: fontDialog - - onAccepted: document.font = fontDialog.selectedFont - onVisibleChanged: if (visible) currentFont = document.font + onAccepted: document.font = selectedFont } - Platform.ColorDialog { + ColorDialog { id: colorDialog - currentColor: "black" + selectedColor: "black" + onAccepted: document.textColor = selectedColor } MessageDialog { @@ -290,14 +289,20 @@ ApplicationWindow { font.underline: document.underline font.strikeout: document.strikeout focusPolicy: Qt.TabFocus - onClicked: fontDialog.open() + onClicked: function () { + fontDialog.selectedFont = document.font + fontDialog.open() + } } ToolButton { id: textColorButton text: "\uF1FC" // icon-brush font.family: "fontello" focusPolicy: Qt.TabFocus - onClicked: colorDialog.open() + onClicked: function () { + colorDialog.selectedColor = document.textColor + colorDialog.open() + } Rectangle { width: aFontMetrics.width + 3 @@ -368,7 +373,6 @@ ApplicationWindow { cursorPosition: textArea.cursorPosition selectionStart: textArea.selectionStart selectionEnd: textArea.selectionEnd - textColor: colorDialog.color property alias family: document.font.family property alias bold: document.font.bold @@ -451,12 +455,18 @@ ApplicationWindow { Platform.MenuItem { text: qsTr("Font...") - onTriggered: fontDialog.open() + onTriggered: function () { + fontDialog.selectedFont = document.font + fontDialog.open() + } } Platform.MenuItem { text: qsTr("Color...") - onTriggered: colorDialog.open() + onTriggered: function () { + colorDialog.selectedColor = document.textColor + colorDialog.open() + } } } diff --git a/examples/quickcontrols2/texteditor/qtquickcontrols2.conf b/examples/quickcontrols2/texteditor/qtquickcontrols2.conf deleted file mode 100644 index ecac617fcb..0000000000 --- a/examples/quickcontrols2/texteditor/qtquickcontrols2.conf +++ /dev/null @@ -1,11 +0,0 @@ -[Controls] -Style=Material - -[Material] -Primary=White -Foreground=#444444 -Accent=Blue -Theme=System - -[Universal] -Theme=System diff --git a/examples/quickcontrols2/texteditor/texteditor.qrc b/examples/quickcontrols2/texteditor/texteditor.qrc index 8f2da8432b..cdb7225a39 100644 --- a/examples/quickcontrols2/texteditor/texteditor.qrc +++ b/examples/quickcontrols2/texteditor/texteditor.qrc @@ -1,6 +1,5 @@ <RCC> <qresource prefix="/"> - <file>qtquickcontrols2.conf</file> <file>images/qt-logo.png</file> <file>fonts/fontello.ttf</file> <file>qml/texteditor.qml</file> |