From 7d73d279f70910e13183670a036825d8c6fb179c Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Wed, 14 Aug 2024 14:38:24 +0200 Subject: [PATCH] QmlProjectManager: Add option for QDS compatible projects This adds a "Create a project that you can open in QDS" checkbox. With that being checked, the wizard uses QDS's General -> Empty application templates to create a .qmlproject based project. It is a replacement for the former, now defunct option for generating an equivalent CMake based project. QDS's templates make use of the QtQuick.Studio.Application plugin. The former, CMake based project made that plugin available via the build system. This new qmlproject based project relies on the plugin being pre-installed in the selected Qt version. Fixes: QTCREATORBUG-31355 Change-Id: I00ab0913c9ad29476070e426547b2320499195d3 Reviewed-by: Knud Dollereder --- .../projects/qtquickuiprototype/wizard.json | 102 +++++++++++++++++- 1 file changed, 98 insertions(+), 4 deletions(-) diff --git a/share/qtcreator/templates/wizards/projects/qtquickuiprototype/wizard.json b/share/qtcreator/templates/wizards/projects/qtquickuiprototype/wizard.json index f8d9373e69d..7ce0c621901 100644 --- a/share/qtcreator/templates/wizards/projects/qtquickuiprototype/wizard.json +++ b/share/qtcreator/templates/wizards/projects/qtquickuiprototype/wizard.json @@ -15,7 +15,21 @@ [ { "key": "QmlProjectFileName", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'qmlproject')}" }, { "key": "MainQmlFileName", "value": "%{JS: Util.fileName(value('ProjectName'), 'qml')}" }, - { "key": "UseVirtualKeyboardByDefault", "value": "%{JS: value('Plugins').indexOf('Boot2Qt') >= 0 || value('Plugins').indexOf('Boot2QtQdb') >= 0}" } + { "key": "UseVirtualKeyboardByDefault", "value": "%{JS: value('Plugins').indexOf('Boot2Qt') >= 0 || value('Plugins').indexOf('Boot2QtQdb') >= 0}" }, + { "key": "QdsWizardPath", "value": "%{IDE:ResourcePath}/qmldesigner/studio_templates/projects" }, + { "key": "NoQdsProjectStyle", "value": "%{JS: !%{QdsProjectStyle} }" }, + + { "key": "AssetDir", "value": "Generated" }, + { "key": "ContentDir", "value": "%{ProjectName}Content" }, + { "key": "ImportModuleName", "value": "%{ProjectName}" }, + { "key": "ImportModuleVersion", "value": "" }, + { "key": "IsQt6Project", "value": true }, + { "key": "QtQuickControlsStyle", "value": "Material" }, + { "key": "QtQuickControlsStyleTheme", "value": "Light" }, + { "key": "QtQuickVersion", "value": "6.5" }, + { "key": "ScreenHeight", "value": 1080 }, + { "key": "ScreenWidth", "value": 1920 }, + { "key": "UIClassName", "value": "Screen01" } ], "pages": @@ -31,6 +45,17 @@ "typeId": "Fields", "data": [ + { + "name": "QdsProjectStyle", + "trDisplayName": "Create a project that you can open in Qt Design Studio", + "trToolTip": "Creates a project with a structure that is compatible both with Qt Design Studio and with Qt Creator. It contains a .ui.qml form that you can visually edit in Qt Design Studio.", + "type": "CheckBox", + "persistenceKey": "QtQuick.QdsProjectStyle", + "data": + { + "checked": false + } + }, { "name": "UseVirtualKeyboard", "trDisplayName": "Use Qt Virtual Keyboard", @@ -66,17 +91,86 @@ { "source": "app.qmlproject", "target": "%{QmlProjectFileName}", - "openAsProject": true + "openAsProject": true, + "condition": "%{NoQdsProjectStyle}" }, { "source": "../qtquickapplication/Main.qml.tpl", "target": "%{ProjectDirectory}/%{MainQmlFileName}", - "openInEditor": true + "openInEditor": true, + "condition": "%{NoQdsProjectStyle}" }, { "source": "../git.ignore", "target": "%{ProjectDirectory}/.gitignore", - "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}" + "condition": "%{JS: %{NoQdsProjectStyle} && !value('IsSubproject') && value('VersionControl') === 'G.Git'}" + } + ] + }, + { + "typeId": "File", + "data": + [ + { + "source": "%{QdsWizardPath}/common/app.qmlproject.tpl", + "target": "%{QmlProjectFileName}", + "openAsProject": true, + "condition": "%{QdsProjectStyle}" + }, + { + "source": "%{QdsWizardPath}/common/qtquickcontrols2.conf.tpl", + "target": "%{ProjectDirectory}/qtquickcontrols2.conf", + "condition": "%{QdsProjectStyle}" + }, + { + "source": "%{QdsWizardPath}/common/App.qml.tpl", + "target": "%{ProjectDirectory}/%{ContentDir}/App.qml", + "condition": "%{QdsProjectStyle}" + }, + { + "source": "%{QdsWizardPath}/application/Screen01.ui.qml.tpl", + "target": "%{ProjectDirectory}/%{ContentDir}/Screen01.ui.qml", + "condition": "%{QdsProjectStyle}" + }, + { + "source": "%{QdsWizardPath}/common/fonts.txt", + "target": "%{ProjectDirectory}/%{ContentDir}/fonts/fonts.txt", + "condition": "%{QdsProjectStyle}" + }, + { + "source": "%{QdsWizardPath}/common/asset_imports.txt", + "target": "%{ProjectDirectory}/%{AssetDir}/Quick3DAssets.txt", + "condition": "%{QdsProjectStyle}" + }, + { + "source": "%{QdsWizardPath}/shared-plugin/name/importmodule.qmldir.tpl", + "target": "%{ProjectDirectory}/%{ImportModuleName}/qmldir", + "condition": "%{QdsProjectStyle}" + }, + { + "source": "%{QdsWizardPath}/shared-plugin/name/Constants.qml.tpl", + "target": "%{ProjectDirectory}/%{ImportModuleName}/Constants.qml", + "condition": "%{QdsProjectStyle}" + }, + { + "source": "%{QdsWizardPath}/shared-plugin/name/DirectoryFontLoader.qml.tpl", + "target": "%{ProjectDirectory}/%{ImportModuleName}/DirectoryFontLoader.qml", + "condition": "%{QdsProjectStyle}" + }, + { + "source": "%{QdsWizardPath}/shared-plugin/name/EventListModel.qml.tpl", + "target": "%{ProjectDirectory}/%{ImportModuleName}/EventListModel.qml", + "condition": "%{QdsProjectStyle}" + }, + { + "source": "%{QdsWizardPath}/shared-plugin/name/EventListSimulator.qml.tpl", + "target": "%{ProjectDirectory}/%{ImportModuleName}/EventListSimulator.qml", + "condition": "%{QdsProjectStyle}" + }, + { + "source": "%{QdsWizardPath}/shared-plugin/name/designer/plugin.metainfo", + "target": "%{ProjectDirectory}/%{ImportModuleName}/designer/plugin.metainfo", + "condition": "%{QdsProjectStyle}" } ] }