Add Qbs support for the QtWidgets application wizard

Change-Id: I7b7b7f0642693900f7ba635414450750380955de
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Christian Kandeler
2019-04-05 16:50:34 +02:00
parent c960885733
commit ef9e6fbcd7
2 changed files with 44 additions and 3 deletions

View File

@@ -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
}

View File

@@ -1,6 +1,6 @@
{ {
"version": 1, "version": 1,
"supportedProjectTypes": [ "CMakeProjectManager.CMakeProject", "Qt4ProjectManager.Qt4Project" ], "supportedProjectTypes": [ "CMakeProjectManager.CMakeProject", "Qt4ProjectManager.Qt4Project", "Qbs.QbsProject" ],
"id": "C.QtWidgets", "id": "C.QtWidgets",
"category": "F.Application", "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.", "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", "trDisplayCategory": "Application",
"icon": "../../global/guiapplication.png", "icon": "../../global/guiapplication.png",
"featuresRequired": [ "QtSupport.Wizards.FeatureQt" ], "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": "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": "ProFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'pro')}" },
{ "key": "CMakeFile", "value": "%{ProjectDirectory}/CMakeLists.txt" }, { "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": "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": "UiHdrFileName", "value": "%{JS: ('%{BuildSystem}' === 'cmake' ? (Util.path('%{FormFileName}') + '/') : '') + 'ui_' + Util.completeBaseName('%{FormFileName}') + '.h'}" },
{ "key": "CN", "value": "%{JS: Cpp.className('%{Class}')}" }, { "key": "CN", "value": "%{JS: Cpp.className('%{Class}')}" },
@@ -54,6 +55,11 @@
"trKey": "CMake", "trKey": "CMake",
"value": "cmake", "value": "cmake",
"condition": "%{JS: [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}" "condition": "%{JS: [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}"
},
{
"trKey": "Qbs",
"value": "qbs",
"condition": "%{JS: [ %{Plugins} ].indexOf('QbsProjectManager') >= 0}"
} }
] ]
} }
@@ -163,6 +169,12 @@
"openAsProject": true, "openAsProject": true,
"condition": "%{JS: '%{BuildSystem}' === 'cmake'}" "condition": "%{JS: '%{BuildSystem}' === 'cmake'}"
}, },
{
"source": "project.qbs",
"target": "%{QbsFile}",
"openAsProject": true,
"condition": "%{JS: '%{BuildSystem}' === 'qbs'}"
},
{ {
"source": "main.cpp", "source": "main.cpp",
"target": "%{MainFileName}", "target": "%{MainFileName}",