From ef9e6fbcd785286e70e49b01ba73129d443b10a9 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 5 Apr 2019 16:50:34 +0200 Subject: [PATCH] Add Qbs support for the QtWidgets application wizard Change-Id: I7b7b7f0642693900f7ba635414450750380955de Reviewed-by: Joerg Bornemann Reviewed-by: Eike Ziller --- .../projects/qtwidgetsapplication/project.qbs | 29 +++++++++++++++++++ .../projects/qtwidgetsapplication/wizard.json | 18 ++++++++++-- 2 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 share/qtcreator/templates/wizards/projects/qtwidgetsapplication/project.qbs diff --git a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/project.qbs b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/project.qbs new file mode 100644 index 00000000000..4a54380d6b2 --- /dev/null +++ b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/project.qbs @@ -0,0 +1,29 @@ +import qbs.FileInfo + +QtApplication { + Depends { name: "Qt.widgets" } + + // The following define makes your compiler emit warnings if you use + // any Qt feature that has been marked deprecated (the exact warnings + // depend on your compiler). Please consult the documentation of the + // deprecated API in order to know how to port your code away from it. + // You can also make your code fail to compile if it uses deprecated APIs. + // In order to do so, uncomment the second entry in the list. + // You can also select to disable deprecated APIs only up to a certain version of Qt. + cpp.defines: [ + "QT_DEPRECATED_WARNINGS", + /* "QT_DISABLE_DEPRECATED_BEFORE=0x060000" */ // disables all the APIs deprecated before Qt 6.0.0 + ] + + files: [ + "%{MainFileName}", + "%{SrcFileName}", + "%{HdrFileName}", + @if %{GenerateForm} + "%{FormFileName}", + @endif + ] + + install: true + installDir: qbs.targetOS.contains("qnx") ? FileInfo.joinPaths("/tmp", name, "bin") : base +} diff --git a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/wizard.json b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/wizard.json index 9aa116177be..004f6e35f84 100644 --- a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/wizard.json +++ b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/wizard.json @@ -1,6 +1,6 @@ { "version": 1, - "supportedProjectTypes": [ "CMakeProjectManager.CMakeProject", "Qt4ProjectManager.Qt4Project" ], + "supportedProjectTypes": [ "CMakeProjectManager.CMakeProject", "Qt4ProjectManager.Qt4Project", "Qbs.QbsProject" ], "id": "C.QtWidgets", "category": "F.Application", "trDescription": "Creates a Qt application for the desktop. Includes a Qt Designer-based main window.\n\nPreselects a desktop Qt for building the application if available.", @@ -8,13 +8,14 @@ "trDisplayCategory": "Application", "icon": "../../global/guiapplication.png", "featuresRequired": [ "QtSupport.Wizards.FeatureQt" ], - "enabled": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0 || [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}", + "enabled": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0 || [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0} || [ %{Plugins} ].indexOf('QbsProjectManager') >= 0}", "options": [ - { "key": "ProjectFile", "value": "%{JS: '%{BuildSystem}' === 'qmake' ? '%{ProFile}' : '%{CMakeFile}'}" }, + { "key": "ProjectFile", "value": "%{JS: '%{BuildSystem}' === 'qmake' ? '%{ProFile}' : '%{BuildSystem}' === 'cmake' ? '%{CMakeFile}' : '%{QbsFile}'}" }, { "key": "ProFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'pro')}" }, { "key": "CMakeFile", "value": "%{ProjectDirectory}/CMakeLists.txt" }, + { "key": "QbsFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'qbs')}" }, { "key": "MainFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src')}" }, { "key": "UiHdrFileName", "value": "%{JS: ('%{BuildSystem}' === 'cmake' ? (Util.path('%{FormFileName}') + '/') : '') + 'ui_' + Util.completeBaseName('%{FormFileName}') + '.h'}" }, { "key": "CN", "value": "%{JS: Cpp.className('%{Class}')}" }, @@ -54,6 +55,11 @@ "trKey": "CMake", "value": "cmake", "condition": "%{JS: [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}" + }, + { + "trKey": "Qbs", + "value": "qbs", + "condition": "%{JS: [ %{Plugins} ].indexOf('QbsProjectManager') >= 0}" } ] } @@ -163,6 +169,12 @@ "openAsProject": true, "condition": "%{JS: '%{BuildSystem}' === 'cmake'}" }, + { + "source": "project.qbs", + "target": "%{QbsFile}", + "openAsProject": true, + "condition": "%{JS: '%{BuildSystem}' === 'qbs'}" + }, { "source": "main.cpp", "target": "%{MainFileName}",