diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/tmpl.qbs b/share/qtcreator/templates/wizards/projects/qtquickapplication/tmpl.qbs new file mode 100644 index 00000000000..3c5b8127cc9 --- /dev/null +++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/tmpl.qbs @@ -0,0 +1,21 @@ +import qbs +CppApplication { +@if "%{UseVirtualKeyboard}" == "true" + Depends { name: "Qt"; submodules: ["quick", "virtualkeyboard"] } +@else + Depends { name: "Qt.quick" } +@endif + install: true + // Additional import path used to resolve QML modules in Qt Creator's code model + property pathList qmlImportPaths: [] + + files: [ + "%{MainCppFileName}", + ] + + Group { + Qt.core.resourcePrefix: "%{ProjectName}/" + fileTags: ["qt.qml.qml", "qt.core.resource_data"] + files: ["main.qml"] + } +} diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/wizard.json b/share/qtcreator/templates/wizards/projects/qtquickapplication/wizard.json index 47022ff578a..885a8487e31 100644 --- a/share/qtcreator/templates/wizards/projects/qtquickapplication/wizard.json +++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/wizard.json @@ -1,6 +1,6 @@ { "version": 1, - "supportedProjectTypes": [ "CMakeProjectManager.CMakeProject" ], + "supportedProjectTypes": [ "CMakeProjectManager.CMakeProject", "QbsProjectManager.QbsProject" ], "id": "U.QtQuickApplicationEmpty", "category": "D.ApplicationQt", "trDescription": "Creates a Qt Quick application that contains an empty window. Optionally, you can create a Qt Design Studio project.", @@ -9,15 +9,16 @@ "icon": "icon.png", "iconKind": "Themed", "featuresRequired": [ "QtSupport.Wizards.FeatureQtQmlCMakeApi" ], - "enabled": "%{JS: value('Plugins').indexOf('CMakeProjectManager') >= 0 }", + "enabled": "%{JS: value('Plugins').indexOf('CMakeProjectManager') >= 0 || value('Plugins').indexOf('QbsProjectManager') >= 0 }", "options": [ - { "key": "ProjectFile", "value": "%{ProjectDirectory}/CMakeLists.txt" }, + { "key": "ProjectFile", "value": "%{JS: value('BuildSystem') === 'cmake' ? '%{ProjectDirectory}/CMakeLists.txt' : '%{ProjectDirectory}/' + '%{ProjectName}'.toLowerCase() + '.qbs' }" }, { "key": "MainCppFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src') }" }, { "key": "UseVirtualKeyboardByDefault", "value": "%{JS: value('Plugins').indexOf('Boot2Qt') >= 0 || value('Plugins').indexOf('Boot2QtQdb') >= 0 }" }, { "key": "TargetName", "value": "%{JS: 'app' + value('ProjectName') }" }, { "key": "QdsWizardPath", "value": "%{IDE:ResourcePath}/qmldesigner/studio_templates/projects" }, + { "key": "QdsProjectStyle", "value": "%{JS: value('BuildSystem') === 'cmake' ? %{QdsProjectStyleInput} : false }" }, { "key": "NoQdsProjectStyle", "value": "%{JS: !%{QdsProjectStyle} }" }, { "key": "ImportModuleName", "value": "%{ProjectName}" }, @@ -42,6 +43,38 @@ "trShortTitle": "Location", "typeId": "Project" }, + { + "trDisplayName": "Define Build System", + "trShortTitle": "Build System", + "typeId": "Fields", + "enabled": "%{JS: ! %{IsSubproject}}", + "data": + [ + { + "name": "BuildSystem", + "trDisplayName": "Build system:", + "type": "ComboBox", + "persistenceKey": "BuildSystemType", + "data": + { + "index": 0, + "items": + [ + { + "trKey": "CMake", + "value": "cmake", + "condition": "%{JS: value('Plugins').indexOf('CMakeProjectManager') >= 0}" + }, + { + "trKey": "Qbs", + "value": "qbs", + "condition": "%{JS: value('Plugins').indexOf('QbsProjectManager') >= 0}" + } + ] + } + } + ] + }, { "trDisplayName": "Define Project Details", "trShortTitle": "Details", @@ -49,11 +82,12 @@ "data": [ { - "name": "QdsProjectStyle", + "name": "QdsProjectStyleInput", "trDisplayName": "Create a project that you can open in Qt Design Studio", "trToolTip": "Create a project with a structure that is compatible both with Qt Design Studio (via .qmlproject) and with Qt Creator (via CMakeLists.txt). It contains a .ui.qml form that you can visually edit in Qt Design Studio.", "type": "CheckBox", "span": true, + "visible": "%{JS: value('BuildSystem') === 'cmake'}", "persistenceKey": "QtQuick.QdsProjectStyle", "data": { @@ -98,7 +132,13 @@ { "source": "CMakeLists.txt", "openAsProject": true, - "condition": "%{NoQdsProjectStyle}" + "condition": "%{JS: %{NoQdsProjectStyle} && value('BuildSystem') === 'cmake' }" + }, + { + "source": "tmpl.qbs", + "target": "%{ProjectFile}", + "openAsProject": true, + "condition": "%{JS: value('BuildSystem') === 'qbs' }" }, { "source": "main.cpp",