From e2c1cfb69fb3fa9b0db13c27af07d30364872930 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Thu, 23 Nov 2023 15:40:38 +0100 Subject: QmlDesigner: Add wizard data for models and backend json data Added the new files to all wizards, since the change of the qmldir file otherwise breaks the wizard. Adding json files to qmlproject for cmake generation. New files have to be added to cmakefiles.txt. Change-Id: If00eb4507b6f1364ce3cfa00db39632635febd09 Reviewed-by: Qt CI Patch Build Bot Reviewed-by: Mahmoud Badri --- .../projects/application-3d/wizard.json | 24 +++++++++++++------- .../projects/application/wizard.json | 24 +++++++++++++------- .../projects/common/app.qmlproject.tpl | 4 ++++ .../projects/desktop-launcher/wizard.json | 24 +++++++++++++------- .../projects/mobile-scroll/wizard.json | 16 +++++++++++++ .../projects/mobile-stack/wizard.json | 16 +++++++++++++ .../projects/mobile-swipe/wizard.json | 16 +++++++++++++ .../name/CMakeLists.importmodule.txt.tpl | 6 ++++- .../projects/shared-plugin/name/DataStore.qml | 15 +++++++++++++ .../projects/shared-plugin/name/JsonData.qml | 9 ++++++++ .../projects/shared-plugin/name/data.json | 4 ++++ .../shared-plugin/name/importmodule.qmldir.tpl | 1 + .../projects/shared-plugin/name/models.json | 24 ++++++++++++++++++++ .../projects/shared-plugin/name/qmldir | 1 + .../projects/qtquickapplication/wizard.json | 26 +++++++++++++--------- 15 files changed, 175 insertions(+), 35 deletions(-) create mode 100644 share/qtcreator/qmldesigner/studio_templates/projects/shared-plugin/name/DataStore.qml create mode 100644 share/qtcreator/qmldesigner/studio_templates/projects/shared-plugin/name/JsonData.qml create mode 100644 share/qtcreator/qmldesigner/studio_templates/projects/shared-plugin/name/data.json create mode 100644 share/qtcreator/qmldesigner/studio_templates/projects/shared-plugin/name/models.json diff --git a/share/qtcreator/qmldesigner/studio_templates/projects/application-3d/wizard.json b/share/qtcreator/qmldesigner/studio_templates/projects/application-3d/wizard.json index 232dfd4319..cf30f9c91c 100644 --- a/share/qtcreator/qmldesigner/studio_templates/projects/application-3d/wizard.json +++ b/share/qtcreator/qmldesigner/studio_templates/projects/application-3d/wizard.json @@ -367,14 +367,6 @@ "source": "../shared-plugin/name/Constants.qml.tpl", "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/Constants.qml" }, - { - "source": "../shared-plugin/name/DataStore.json.tpl", - "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/DataStore.json" - }, - { - "source": "../shared-plugin/name/DataStore.qml.tpl", - "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/DataStore.qml" - }, { "source": "../shared-plugin/name/DirectoryFontLoader.qml.tpl", "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/DirectoryFontLoader.qml" @@ -390,6 +382,22 @@ { "source": "../shared-plugin/name/designer/plugin.metainfo", "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/designer/plugin.metainfo" + }, + { + "source": "../shared-plugin/name/JsonData.qml", + "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/JsonData.qml" + }, + { + "source": "../shared-plugin/name/DataStore.qml", + "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/DataStore.qml" + }, + { + "source": "../shared-plugin/name/models.json", + "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/models.json" + }, + { + "source": "../shared-plugin/name/data.json", + "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/data.json" } ] } diff --git a/share/qtcreator/qmldesigner/studio_templates/projects/application/wizard.json b/share/qtcreator/qmldesigner/studio_templates/projects/application/wizard.json index 2c5d606750..6fd0637fb1 100644 --- a/share/qtcreator/qmldesigner/studio_templates/projects/application/wizard.json +++ b/share/qtcreator/qmldesigner/studio_templates/projects/application/wizard.json @@ -380,14 +380,6 @@ "source": "../shared-plugin/name/Constants.qml.tpl", "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/Constants.qml" }, - { - "source": "../shared-plugin/name/DataStore.json.tpl", - "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/DataStore.json" - }, - { - "source": "../shared-plugin/name/DataStore.qml.tpl", - "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/DataStore.qml" - }, { "source": "../shared-plugin/name/DirectoryFontLoader.qml.tpl", "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/DirectoryFontLoader.qml" @@ -403,6 +395,22 @@ { "source": "../shared-plugin/name/designer/plugin.metainfo", "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/designer/plugin.metainfo" + }, + { + "source": "../shared-plugin/name/JsonData.qml", + "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/JsonData.qml" + }, + { + "source": "../shared-plugin/name/DataStore.qml", + "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/DataStore.qml" + }, + { + "source": "../shared-plugin/name/models.json", + "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/models.json" + }, + { + "source": "../shared-plugin/name/data.json", + "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/data.json" } ] } diff --git a/share/qtcreator/qmldesigner/studio_templates/projects/common/app.qmlproject.tpl b/share/qtcreator/qmldesigner/studio_templates/projects/common/app.qmlproject.tpl index 6169688f16..2a42e7222c 100644 --- a/share/qtcreator/qmldesigner/studio_templates/projects/common/app.qmlproject.tpl +++ b/share/qtcreator/qmldesigner/studio_templates/projects/common/app.qmlproject.tpl @@ -63,6 +63,10 @@ Project { filter: "*.qsb" } + Files { + filter: "*.json" + } + Files { filter: "*.mesh" directory: "asset_imports" diff --git a/share/qtcreator/qmldesigner/studio_templates/projects/desktop-launcher/wizard.json b/share/qtcreator/qmldesigner/studio_templates/projects/desktop-launcher/wizard.json index 81bbcb73f2..bb3e4851f9 100644 --- a/share/qtcreator/qmldesigner/studio_templates/projects/desktop-launcher/wizard.json +++ b/share/qtcreator/qmldesigner/studio_templates/projects/desktop-launcher/wizard.json @@ -367,14 +367,6 @@ "source": "../shared-plugin/name/Constants.qml.tpl", "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/Constants.qml" }, - { - "source": "../shared-plugin/name/DataStore.json.tpl", - "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/DataStore.json" - }, - { - "source": "../shared-plugin/name/DataStore.qml.tpl", - "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/DataStore.qml" - }, { "source": "../shared-plugin/name/DirectoryFontLoader.qml.tpl", "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/DirectoryFontLoader.qml" @@ -390,6 +382,22 @@ { "source": "../shared-plugin/name/designer/plugin.metainfo", "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/designer/plugin.metainfo" + }, + { + "source": "../shared-plugin/name/JsonData.qml", + "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/JsonData.qml" + }, + { + "source": "../shared-plugin/name/DataStore.qml", + "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/DataStore.qml" + }, + { + "source": "../shared-plugin/name/models.json", + "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/models.json" + }, + { + "source": "../shared-plugin/name/data.json", + "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/data.json" } ] } diff --git a/share/qtcreator/qmldesigner/studio_templates/projects/mobile-scroll/wizard.json b/share/qtcreator/qmldesigner/studio_templates/projects/mobile-scroll/wizard.json index 944b6b6289..104d349bcc 100644 --- a/share/qtcreator/qmldesigner/studio_templates/projects/mobile-scroll/wizard.json +++ b/share/qtcreator/qmldesigner/studio_templates/projects/mobile-scroll/wizard.json @@ -341,6 +341,22 @@ { "source": "../shared-plugin/name/designer/plugin.metainfo", "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/designer/plugin.metainfo" + }, + { + "source": "../shared-plugin/name/JsonData.qml", + "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/JsonData.qml" + }, + { + "source": "../shared-plugin/name/DataStore.qml", + "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/DataStore.qml" + }, + { + "source": "../shared-plugin/name/models.json", + "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/models.json" + }, + { + "source": "../shared-plugin/name/data.json", + "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/data.json" } ] } diff --git a/share/qtcreator/qmldesigner/studio_templates/projects/mobile-stack/wizard.json b/share/qtcreator/qmldesigner/studio_templates/projects/mobile-stack/wizard.json index c8733770e0..d8758ca2bf 100644 --- a/share/qtcreator/qmldesigner/studio_templates/projects/mobile-stack/wizard.json +++ b/share/qtcreator/qmldesigner/studio_templates/projects/mobile-stack/wizard.json @@ -343,6 +343,22 @@ { "source": "../shared-plugin/name/designer/plugin.metainfo", "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/designer/plugin.metainfo" + }, + { + "source": "../shared-plugin/name/JsonData.qml", + "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/JsonData.qml" + }, + { + "source": "../shared-plugin/name/DataStore.qml", + "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/DataStore.qml" + }, + { + "source": "../shared-plugin/name/models.json", + "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/models.json" + }, + { + "source": "../shared-plugin/name/data.json", + "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/data.json" } ] } diff --git a/share/qtcreator/qmldesigner/studio_templates/projects/mobile-swipe/wizard.json b/share/qtcreator/qmldesigner/studio_templates/projects/mobile-swipe/wizard.json index 295c85aa63..0661a77b7b 100644 --- a/share/qtcreator/qmldesigner/studio_templates/projects/mobile-swipe/wizard.json +++ b/share/qtcreator/qmldesigner/studio_templates/projects/mobile-swipe/wizard.json @@ -343,6 +343,22 @@ { "source": "../shared-plugin/name/designer/plugin.metainfo", "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/designer/plugin.metainfo" + }, + { + "source": "../shared-plugin/name/JsonData.qml", + "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/JsonData.qml" + }, + { + "source": "../shared-plugin/name/DataStore.qml", + "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/DataStore.qml" + }, + { + "source": "../shared-plugin/name/models.json", + "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/models.json" + }, + { + "source": "../shared-plugin/name/data.json", + "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/data.json" } ] } diff --git a/share/qtcreator/qmldesigner/studio_templates/projects/shared-plugin/name/CMakeLists.importmodule.txt.tpl b/share/qtcreator/qmldesigner/studio_templates/projects/shared-plugin/name/CMakeLists.importmodule.txt.tpl index 5606f3c7b1..3b74123f7b 100644 --- a/share/qtcreator/qmldesigner/studio_templates/projects/shared-plugin/name/CMakeLists.importmodule.txt.tpl +++ b/share/qtcreator/qmldesigner/studio_templates/projects/shared-plugin/name/CMakeLists.importmodule.txt.tpl @@ -11,10 +11,14 @@ qt6_add_qml_module(%{ImportModuleName} URI "%{ImportModuleName}" VERSION 1.0 RESOURCE_PREFIX "/qt/qml" - QML_FILES + QML_FILES Constants.qml DataStore.qml DirectoryFontLoader.qml EventListModel.qml EventListSimulator.qml + JsonData.qml + RESOURCES + data.json + models.json ) diff --git a/share/qtcreator/qmldesigner/studio_templates/projects/shared-plugin/name/DataStore.qml b/share/qtcreator/qmldesigner/studio_templates/projects/shared-plugin/name/DataStore.qml new file mode 100644 index 0000000000..32acc1d817 --- /dev/null +++ b/share/qtcreator/qmldesigner/studio_templates/projects/shared-plugin/name/DataStore.qml @@ -0,0 +1,15 @@ +pragma Singleton +import QtQuick 6.5 +import QtQuick.Studio.Utils 1.0 + +JsonListModel { + id: models + source: Qt.resolvedUrl("models.json") + + property ChildListModel exampleModel: ChildListModel { + modelName: "exampleModel" + } + + property JsonData backend: JsonData {} +} + diff --git a/share/qtcreator/qmldesigner/studio_templates/projects/shared-plugin/name/JsonData.qml b/share/qtcreator/qmldesigner/studio_templates/projects/shared-plugin/name/JsonData.qml new file mode 100644 index 0000000000..a49600e270 --- /dev/null +++ b/share/qtcreator/qmldesigner/studio_templates/projects/shared-plugin/name/JsonData.qml @@ -0,0 +1,9 @@ +import QtQuick 2.15 +import QtQuick.Controls 2.15 +import QtQuick.Studio.Utils 1.0 + +JsonBackend { + property string name: "someName" + property int number: 1 + source: Qt.resolvedUrl("data.json") +} diff --git a/share/qtcreator/qmldesigner/studio_templates/projects/shared-plugin/name/data.json b/share/qtcreator/qmldesigner/studio_templates/projects/shared-plugin/name/data.json new file mode 100644 index 0000000000..71208c1808 --- /dev/null +++ b/share/qtcreator/qmldesigner/studio_templates/projects/shared-plugin/name/data.json @@ -0,0 +1,4 @@ +{ + "name": "Christen Anderson", + "number": "+3455641" +} diff --git a/share/qtcreator/qmldesigner/studio_templates/projects/shared-plugin/name/importmodule.qmldir.tpl b/share/qtcreator/qmldesigner/studio_templates/projects/shared-plugin/name/importmodule.qmldir.tpl index a0ec2f17cf..8f451c8494 100644 --- a/share/qtcreator/qmldesigner/studio_templates/projects/shared-plugin/name/importmodule.qmldir.tpl +++ b/share/qtcreator/qmldesigner/studio_templates/projects/shared-plugin/name/importmodule.qmldir.tpl @@ -4,3 +4,4 @@ singleton Constants 1.0 Constants.qml EventListSimulator 1.0 EventListSimulator.qml EventListModel 1.0 EventListModel.qml DirectoryFontLoader 1.0 DirectoryFontLoader.qml +singleton DataStore 1.0 DataStore.qml diff --git a/share/qtcreator/qmldesigner/studio_templates/projects/shared-plugin/name/models.json b/share/qtcreator/qmldesigner/studio_templates/projects/shared-plugin/name/models.json new file mode 100644 index 0000000000..17eb0e92b3 --- /dev/null +++ b/share/qtcreator/qmldesigner/studio_templates/projects/shared-plugin/name/models.json @@ -0,0 +1,24 @@ +{ + "exampleModel": [ + { + "name": "Christen Anderson", + "number": "+3455641" + }, + { + "name": "Armanda Cox", + "number": "+21155641" + }, + { + "name": "Ken Garza", + "number": "+3288642" + }, + { + "name": "Rodney Hamilton", + "number": "+3558848" + }, + { + "name": "Andrew Battles", + "number": "+42488649" + } + ] +} diff --git a/share/qtcreator/qmldesigner/studio_templates/projects/shared-plugin/name/qmldir b/share/qtcreator/qmldesigner/studio_templates/projects/shared-plugin/name/qmldir index b5924a433c..d99371ee1d 100644 --- a/share/qtcreator/qmldesigner/studio_templates/projects/shared-plugin/name/qmldir +++ b/share/qtcreator/qmldesigner/studio_templates/projects/shared-plugin/name/qmldir @@ -3,3 +3,4 @@ singleton DataStore 1.0 DataStore.qml EventListModel 1.0 EventListModel.qml EventListSimulator 1.0 EventListSimulator.qml DirectoryFontLoader 1.0 DirectoryFontLoader.qml +singleton DataStore 1.0 DataStore.qml diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/wizard.json b/share/qtcreator/templates/wizards/projects/qtquickapplication/wizard.json index 64502bd124..b1c8c5fb74 100644 --- a/share/qtcreator/templates/wizards/projects/qtquickapplication/wizard.json +++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/wizard.json @@ -242,16 +242,6 @@ "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/Constants.qml", "condition": "%{QdsProjectStyle}" }, - { - "source": "%{QdsWizardPath}/shared-plugin/name/DataStore.json.tpl", - "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/DataStore.json", - "condition": "%{QdsProjectStyle}" - }, - { - "source": "%{QdsWizardPath}/shared-plugin/name/DataStore.qml.tpl", - "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/DataStore.qml", - "condition": "%{QdsProjectStyle}" - }, { "source": "%{QdsWizardPath}/shared-plugin/name/DirectoryFontLoader.qml.tpl", "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/DirectoryFontLoader.qml", @@ -271,6 +261,22 @@ "source": "%{QdsWizardPath}/shared-plugin/name/designer/plugin.metainfo", "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/designer/plugin.metainfo", "condition": "%{QdsProjectStyle}" + }, + { + "source": "../shared-plugin/name/JsonData.qml", + "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/JsonData.qml" + }, + { + "source": "../shared-plugin/name/DataStore.qml", + "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/DataStore.qml" + }, + { + "source": "../shared-plugin/name/models.json", + "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/models.json" + }, + { + "source": "../shared-plugin/name/data.json", + "target": "%{ProjectDirectory}/imports/%{ImportModuleName}/data.json" } ] } -- cgit v1.2.3