diff options
Diffstat (limited to 'share/qtcreator/templates/wizards')
78 files changed, 1691 insertions, 589 deletions
diff --git a/share/qtcreator/templates/wizards/autotest/files/tst.pro b/share/qtcreator/templates/wizards/autotest/files/tst.pro index a973d1a9cb..1d59f9c05f 100644 --- a/share/qtcreator/templates/wizards/autotest/files/tst.pro +++ b/share/qtcreator/templates/wizards/autotest/files/tst.pro @@ -44,3 +44,23 @@ HEADERS += \\ SOURCES += \\ %{MainCppName} @endif +@if "%{TestFrameWork}" == "BoostTest" +TEMPLATE = app +CONFIG -= qt +CONFIG -= app_bundle +CONFIG += console + +isEmpty(BOOST_INCLUDE_DIR): BOOST_INCLUDE_DIR=$$(BOOST_INCLUDE_DIR) +@if "%{BoostIncDir}" != "" +# set by Qt Creator wizard +isEmpty(BOOST_INCLUDE_DIR): BOOST_INCLUDE_DIR="%{BoostIncDir}" +@endif +!isEmpty(BOOST_INCLUDE_DIR): INCLUDEPATH *= $${BOOST_INCLUDE_DIR} + +isEmpty(BOOST_INCLUDE_DIR): { + message("BOOST_INCLUDE_DIR is not set, assuming Boost can be found automatically in your system") +} + +SOURCES += \\ + %{MainCppName} +@endif diff --git a/share/qtcreator/templates/wizards/autotest/files/tst.qbs b/share/qtcreator/templates/wizards/autotest/files/tst.qbs index 14d277a429..92a0656d65 100644 --- a/share/qtcreator/templates/wizards/autotest/files/tst.qbs +++ b/share/qtcreator/templates/wizards/autotest/files/tst.qbs @@ -3,6 +3,10 @@ import qbs import qbs.Environment import "googlecommon.js" as googleCommon @endif +@if "%{TestFrameWork}" == "BoostTest" +import qbs.Environment +import qbs.File +@endif CppApplication { @if "%{TestFrameWork}" == "QtTest" @@ -72,4 +76,28 @@ CppApplication { cpp.defines: base.concat("QUICK_TEST_SOURCE_DIR=\\"" + path + "\\"") @endif +@if "%{TestFrameWork}" == "BoostTest" + type: "application" + + property string boostIncDir: { + if (typeof Environment.getEnv("BOOST_INCLUDE_DIR") !== 'undefined') + return Environment.getEnv("BOOST_INCLUDE_DIR"); + return "%{BoostIncDir}"; // set by Qt Creator wizard + } + + Properties { + condition: boostIncDir && File.exists(boostIncDir) + cpp.includePaths: [boostIncDir]; + } + + condition: { + if (!boostIncDir) + console.log("BOOST_INCLUDE_DIR is not set, assuming Boost can be " + + "found automatically in your system"); + return true; + } + + files: [ "%{MainCppName}" ] + +@endif } diff --git a/share/qtcreator/templates/wizards/autotest/files/tst.txt b/share/qtcreator/templates/wizards/autotest/files/tst.txt index 239e7087f8..bf5e75ff16 100644 --- a/share/qtcreator/templates/wizards/autotest/files/tst.txt +++ b/share/qtcreator/templates/wizards/autotest/files/tst.txt @@ -1,7 +1,6 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) -PROJECT(%{TestCaseName} - LANGUAGES CXX) +project(%{TestCaseName} LANGUAGES CXX) @if "%{TestFrameWork}" == "QtTest" @@ -10,38 +9,46 @@ find_package(Qt5Test REQUIRED) find_package(Qt5Gui REQUIRED) @endif -SET(CMAKE_AUTOMOC ON) -SET(CMAKE_INCLUDE_CURRENT_DIR ON) -SET(CMAKE_CXX_STANDARD 11) -SET(CMAKE_CXX_STANDARD_REQUIRED ON) -ENABLE_TESTING() +set(CMAKE_INCLUDE_CURRENT_DIR ON) -add_executable(${PROJECT_NAME} %{TestCaseFileWithCppSuffix}) -add_test(${PROJECT_NAME} COMMAND ${PROJECT_NAME}) +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +enable_testing() + +add_executable(%{TestCaseName} %{TestCaseFileWithCppSuffix}) +add_test(%{TestCaseName} COMMAND %{TestCaseName}) @if "%{RequireGUI}" == "true" -target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Gui Qt5::Test) +target_link_libraries(%{TestCaseName} PRIVATE Qt5::Gui Qt5::Test) @else -target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Test) +target_link_libraries(%{TestCaseName} PRIVATE Qt5::Test) @endif @endif @if "%{TestFrameWork}" == "QtQuickTest" find_package(Qt5QuickTest REQUIRED) -SET(CMAKE_AUTOMOC ON) -SET(CMAKE_INCLUDE_CURRENT_DIR ON) -SET(CMAKE_CXX_STANDARD 11) -SET(CMAKE_CXX_STANDARD_REQUIRED ON) -ENABLE_TESTING() +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +enable_testing() # no need to copy around qml test files for shadow builds - just set the respective define add_definitions(-DQUICK_TEST_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}") -add_executable(${PROJECT_NAME} %{MainCppName}) -add_test(${PROJECT_NAME} COMMAND ${PROJECT_NAME}) +add_executable(%{TestCaseName} %{MainCppName}) +add_test(%{TestCaseName} COMMAND %{TestCaseName}) -target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::QuickTest) +target_link_libraries(%{TestCaseName} PRIVATE Qt5::QuickTest) @endif @if "%{TestFrameWork}" == "GTest" @@ -53,14 +60,14 @@ add_definitions(-DGTEST_LANGUAGE_CXX11) find_package(Threads REQUIRED) if ($ENV{GOOGLETEST_DIR}) - SET(GOOGLETEST_DIR $ENV{GOOGLETEST_DIR}) + set(GOOGLETEST_DIR $ENV{GOOGLETEST_DIR}) else () message(WARNING "Using googletest src dir specified at Qt Creator wizard") - SET(GOOGLETEST_DIR "%{GTestRepository}") + set(GOOGLETEST_DIR "%{GTestRepository}") endif () if (EXISTS ${GOOGLETEST_DIR}) - SET(GTestSrc ${GOOGLETEST_DIR}/googletest) - SET(GMockSrc ${GOOGLETEST_DIR}/googlemock) + set(GTestSrc ${GOOGLETEST_DIR}/googletest) + set(GMockSrc ${GOOGLETEST_DIR}/googlemock) else () message( FATAL_ERROR "No googletest src dir found - set GOOGLETEST_DIR to enable!") endif () @@ -68,10 +75,31 @@ endif () include_directories(${GTestSrc} ${GTestSrc}/include ${GMockSrc} ${GMockSrc}/include) -add_executable(${PROJECT_NAME} %{MainCppName} %{TestCaseFileWithHeaderSuffix} +add_executable(%{TestCaseName} %{MainCppName} %{TestCaseFileWithHeaderSuffix} ${GTestSrc}/src/gtest-all.cc ${GMockSrc}/src/gmock-all.cc) -add_test(${PROJECT_NAME} COMMAND ${PROJECT_NAME}) -target_link_libraries(${PROJECT_NAME} PRIVATE Threads::Threads) +add_test(%{TestCaseName} COMMAND %{TestCaseName}) +target_link_libraries(%{TestCaseName} PRIVATE Threads::Threads) + +@endif +@if "%{TestFrameWork}" == "BoostTest" +set(CMAKE_INCLUDE_CURRENT_DIR ON) +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +enable_testing() + +add_executable(%{TestCaseName} %{MainCppName}) +add_test(%{TestCaseName} COMMAND %{TestCaseName}) + +if (DEFINED ENV{BOOST_INCLUDE_DIR}) + set(BOOST_INCLUDE_DIR $ENV{BOOST_INCLUDE_DIR}) +else () + set(BOOST_INCLUDE_DIR "%{BoostIncDir}") # set by Qt Creator wizard +endif () +if (BOOST_INCLUDE_DIR STREQUAL "") + message("BOOST_INCLUDE_DIR is not set, assuming Boost can be found automatically in your system") +elseif (EXISTS ${BOOST_INCLUDE_DIR}) + include_directories(${BOOST_INCLUDE_DIR}) +endif () @endif diff --git a/share/qtcreator/templates/wizards/autotest/files/tst_main.cpp b/share/qtcreator/templates/wizards/autotest/files/tst_main.cpp index d918350551..923fad9f9b 100644 --- a/share/qtcreator/templates/wizards/autotest/files/tst_main.cpp +++ b/share/qtcreator/templates/wizards/autotest/files/tst_main.cpp @@ -2,7 +2,8 @@ #include <QtQuickTest/quicktest.h> QUICK_TEST_MAIN(example) -@else +@endif +@if "%{TestFrameWork}" == "GTest" %{Cpp:LicenseTemplate}\ #include "%{TestCaseFileWithHeaderSuffix}" @@ -14,3 +15,12 @@ int main(int argc, char *argv[]) return RUN_ALL_TESTS(); } @endif +@if "%{TestFrameWork}" == "BoostTest" +#define BOOST_TEST_MODULE %{TestSuiteName} +#include <boost/test/included/unit_test.hpp> + +BOOST_AUTO_TEST_CASE( %{TestCaseName} ) +{ + BOOST_TEST( true /* test assertion */ ); +} +@endif diff --git a/share/qtcreator/templates/wizards/autotest/files/tst_src.h b/share/qtcreator/templates/wizards/autotest/files/tst_src.h index 9e6c619c5f..ef29240cd5 100644 --- a/share/qtcreator/templates/wizards/autotest/files/tst_src.h +++ b/share/qtcreator/templates/wizards/autotest/files/tst_src.h @@ -11,7 +11,7 @@ using namespace testing; -TEST(%{TestCaseName}, %{TestSetName}) +TEST(%{TestSuiteName}, %{TestCaseName}) { EXPECT_EQ(1, 1); ASSERT_THAT(0, Eq(0)); diff --git a/share/qtcreator/templates/wizards/autotest/wizard.json b/share/qtcreator/templates/wizards/autotest/wizard.json index 64e8b8d6af..83a4be09a4 100644 --- a/share/qtcreator/templates/wizards/autotest/wizard.json +++ b/share/qtcreator/templates/wizards/autotest/wizard.json @@ -8,19 +8,19 @@ "trDisplayCategory": "Other Project", "icon": "autotest.png", "featuresRequired": [ "QtSupport.Wizards.FeatureDesktop" ], - "enabled": "%{JS: [ %{Plugins} ].indexOf('AutoTest') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('AutoTest') >= 0}", "options": [ { "key": "ProjectFilePath", - "value": "%{JS: '%{BuildSystem}' == 'qmake' ? '%{ProFileName}' : ('%{BuildSystem}' == 'qbs' ? '%{QbsFileName}' : '%{CMakeFileName}') }" + "value": "%{JS: value('BuildSystem') == 'qmake' ? value('ProFileName') : (value('BuildSystem') == 'qbs' ? value('QbsFileName') : value('CMakeFileName')) }" }, { "key": "ProFileName", - "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'pro')}" + "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'pro')}" }, { "key": "QbsFileName", - "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'qbs')}" + "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'qbs')}" }, { "key": "CMakeFileName", @@ -34,19 +34,19 @@ }, { "key": "TestCaseFileWithHeaderSuffix", - "value": "%{JS: 'tst_%{TestCaseName}.'.toLowerCase() + Util.preferredSuffix('text/x-c++hdr') }" + "value": "%{JS: 'tst_' + value('TestCaseName').toLowerCase() + '.' + Util.preferredSuffix('text/x-c++hdr') }" }, { "key": "GUARD", - "value": "%{JS: '%{TestCaseFileWithHeaderSuffix}'.toUpperCase().replace('.', '_') }" + "value": "%{JS: value('TestCaseFileWithHeaderSuffix').toUpperCase().replace('.', '_') }" }, { "key": "TestCaseFileWithCppSuffix", - "value": "%{JS: 'tst_%{TestCaseName}.'.toLowerCase() + Util.preferredSuffix('text/x-c++src') }" + "value": "%{JS: 'tst_' + value('TestCaseName').toLowerCase() + '.' + Util.preferredSuffix('text/x-c++src') }" }, { "key": "TestCaseFileWithQmlSuffix", - "value": "%{JS: 'tst_%{TestCaseName}.qml'.toLowerCase() }" + "value": "%{JS: 'tst_' + value('TestCaseName').toLowerCase() + '.qml' }" } ], @@ -87,6 +87,10 @@ { "trKey": "Qt Quick Test", "value": "QtQuickTest" + }, + { + "trKey": "Boost Test", + "value": "BoostTest" } ] @@ -95,13 +99,21 @@ { "name": "RequireGUI", "trDisplayName": "GUI Application", - "visible": "%{JS: '%{TestFrameWork}' === 'QtTest'}", + "visible": "%{JS: value('TestFrameWork') === 'QtTest'}", "type": "CheckBox", "data": { "checked": false } }, { + "name": "TestSuiteName", + "trDisplayName": "Test suite name:", + "visible": "%{JS: ['BoostTest', 'GTest'].indexOf(value('TestFrameWork')) >= 0}", + "mandatory": true, + "type": "LineEdit", + "data": { "validator": "^[a-zA-Z_0-9]+$" } + }, + { "name": "TestCaseName", "trDisplayName": "Test case name:", "mandatory": true, @@ -111,7 +123,7 @@ { "name": "RequireApplication", "trDisplayName": "Requires QApplication", - "visible": "%{JS: '%{TestFrameWork}' === 'QtTest'}", + "visible": "%{JS: value('TestFrameWork') === 'QtTest'}", "type": "CheckBox", "data": { "checked": false @@ -120,23 +132,16 @@ { "name": "GenerateInitAndCleanup", "trDisplayName": "Generate initialization and cleanup code", - "visible": "%{JS: [ 'QtTest', 'QtQuickTest' ].indexOf('%{TestFrameWork}') >= 0 }", + "visible": "%{JS: [ 'QtTest', 'QtQuickTest' ].indexOf(value('TestFrameWork')) >= 0 }", "type": "CheckBox", "data": { "checked": false } }, { - "name": "TestSetName", - "trDisplayName": "Test set name:", - "visible": "%{JS: '%{TestFrameWork}' === 'GTest'}", - "type": "LineEdit", - "data": { "validator": "^[a-zA-Z0-9]+$" } - }, - { "name": "GTestCXX11", "trDisplayName": "Enable C++11", - "visible": "%{JS: '%{TestFrameWork}' === 'GTest'}", + "visible": "%{JS: value('TestFrameWork') === 'GTest'}", "type": "CheckBox", "data": { "checked": false @@ -145,7 +150,17 @@ { "name": "GTestRepository", "trDisplayName": "Googletest repository:", - "visible": "%{JS: '%{TestFrameWork}' === 'GTest'}", + "visible": "%{JS: value('TestFrameWork') === 'GTest'}", + "type": "PathChooser", + "data": { + "kind": "existingDirectory" + } + }, + { + "name": "BoostIncDir", + "trDisplayName": "Boost include dir (optional):", + "visible": "%{JS: value('TestFrameWork') == 'BoostTest'}", + "mandatory": false, "type": "PathChooser", "data": { "kind": "existingDirectory" @@ -163,17 +178,17 @@ { "trKey": "qmake", "value": "qmake", - "condition": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0}" }, { "trKey": "CMake", "value": "cmake", - "condition": "%{JS: [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('CMakeProjectManager') >= 0}" }, { "trKey": "Qbs", "value": "qbs", - "condition": "%{JS: [ %{Plugins} ].indexOf('QbsProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('QbsProjectManager') >= 0}" } ] } @@ -187,7 +202,7 @@ "enabled": "%{IsTopLevelProject}", "data": { "projectFilePath": "%{ProjectFilePath}", - "requiredFeatures": [ "%{JS: ('%{TestFrameWork}' === 'QtQuickTest' ? 'QtSupport.Wizards.FeatureQt.5' : (('%{BuildSystem}' === 'qmake' || '%{TestFrameWork}' === 'QtTest') ? 'QtSupport.Wizards.FeatureQt' : 'DeviceType.Desktop' )) }" ] + "requiredFeatures": [ "%{JS: (value('TestFrameWork') === 'QtQuickTest' ? 'QtSupport.Wizards.FeatureQt.5' : ((value('BuildSystem') === 'qmake' || value('TestFrameWork') === 'QtTest') ? 'QtSupport.Wizards.FeatureQt' : 'DeviceType.Desktop' )) }" ] } }, { @@ -205,64 +220,64 @@ { "source": "files/gtest_dependency.pri", "target": "gtest_dependency.pri", - "condition": "%{JS: '%{TestFrameWork}' == 'GTest' && '%{BuildSystem}' == 'qmake'}", + "condition": "%{JS: value('TestFrameWork') == 'GTest' && value('BuildSystem') == 'qmake'}", "openInEditor": false }, { "source": "files/googlecommon.js", "target": "googlecommon.js", - "condition": "%{JS: '%{TestFrameWork}' == 'GTest' && '%{BuildSystem}' == 'qbs'}", + "condition": "%{JS: value('TestFrameWork') == 'GTest' && value('BuildSystem') == 'qbs'}", "openInEditor": false }, { "source": "files/tst.pro", "target": "%{ProjectFilePath}", - "condition": "%{JS: '%{BuildSystem}' == 'qmake'}", + "condition": "%{JS: value('BuildSystem') == 'qmake'}", "openInEditor": false, "openAsProject": true }, { "source": "files/tst.qbs", "target": "%{ProjectFilePath}", - "condition": "%{JS: '%{BuildSystem}' == 'qbs'}", + "condition": "%{JS: value('BuildSystem') == 'qbs'}", "openInEditor": false, "openAsProject": true }, { "source": "files/tst.txt", "target": "CMakeLists.txt", - "condition": "%{JS: '%{BuildSystem}' == 'cmake'}", + "condition": "%{JS: value('BuildSystem') == 'cmake'}", "openInEditor": false, "openAsProject": true }, { "source": "files/tst_src.h", "target": "%{TestCaseFileWithHeaderSuffix}", - "condition": "%{JS: '%{TestFrameWork}' == 'GTest'}", + "condition": "%{JS: value('TestFrameWork') == 'GTest'}", "openInEditor": true }, { "source": "files/tst_src.cpp", "target": "%{TestCaseFileWithCppSuffix}", - "condition": "%{JS: '%{TestFrameWork}' == 'QtTest'}", + "condition": "%{JS: value('TestFrameWork') == 'QtTest'}", "openInEditor": true }, { "source": "files/tst_main.cpp", "target": "%{MainCppName}", - "condition": "%{JS: ['GTest', 'QtQuickTest'].indexOf('%{TestFrameWork}') >= 0}", + "condition": "%{JS: ['GTest', 'QtQuickTest', 'BoostTest'].indexOf(value('TestFrameWork')) >= 0}", "openInEditor": true }, { "source": "files/tst_qml.tmpl", "target": "%{TestCaseFileWithQmlSuffix}", - "condition": "%{JS: '%{TestFrameWork}' === 'QtQuickTest'}", + "condition": "%{JS: value('TestFrameWork') === 'QtQuickTest'}", "openInEditor": true }, { "source": "../projects/git.ignore", "target": ".gitignore", - "condition": "%{JS: ( %{IsTopLevelProject} && '%{VersionControl}' === 'G.Git' )}" + "condition": "%{JS: ( %{IsTopLevelProject} && value('VersionControl') === 'G.Git' )}" } ] } diff --git a/share/qtcreator/templates/wizards/classes/cpp/file.cpp b/share/qtcreator/templates/wizards/classes/cpp/file.cpp index d102ecf4a1..6bf6885858 100644 --- a/share/qtcreator/templates/wizards/classes/cpp/file.cpp +++ b/share/qtcreator/templates/wizards/classes/cpp/file.cpp @@ -1,5 +1,5 @@ %{Cpp:LicenseTemplate}\ -#include "%{HdrFileName}" +#include "%{JS: Util.relativeFilePath('%{Path}/%{HdrFileName}', '%{Path}' + '/' + Util.path('%{SrcFileName}'))}" %{JS: Cpp.openNamespaces('%{Class}')} @if '%{IncludeQSharedData}' class %{CN}Data : public QSharedData diff --git a/share/qtcreator/templates/wizards/classes/cpp/wizard.json b/share/qtcreator/templates/wizards/classes/cpp/wizard.json index 24b1f79b61..ae466ba7ed 100644 --- a/share/qtcreator/templates/wizards/classes/cpp/wizard.json +++ b/share/qtcreator/templates/wizards/classes/cpp/wizard.json @@ -7,18 +7,18 @@ "trDisplayName": "C++ Class", "trDisplayCategory": "C++", "iconText": "h/cpp", - "enabled": "%{JS: [ %{Plugins} ].indexOf('CppEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('CppEditor') >= 0}", "options": [ { "key": "TargetPath", "value": "%{Path}" }, { "key": "HdrPath", "value": "%{Path}/%{HdrFileName}" }, { "key": "SrcPath", "value": "%{Path}/%{SrcFileName}" }, - { "key": "CN", "value": "%{JS: Cpp.className('%{Class}')}" }, - { "key": "Base", "value": "%{JS: ( '%{BaseCB}' === '' ) ? '%{BaseEdit}' : '%{BaseCB}'}" }, - { "key": "isQObject", "value": "%{JS: [ 'QObject', 'QWidget', 'QMainWindow', 'QDeclarativeItem', 'QQuickItem'].indexOf('%{Base}') >= 0 }" }, - { "key": "GUARD", "value": "%{JS: Cpp.headerGuard('%{HdrFileName}')}" }, - { "key": "SharedDataInit", "value": "%{JS: ('%{IncludeQSharedData}') ? 'data(new %{CN}Data)' : '' }" } + { "key": "CN", "value": "%{JS: Cpp.className(value('Class'))}" }, + { "key": "Base", "value": "%{JS: value('BaseCB') === '' ? value('BaseEdit') : value('BaseCB')}" }, + { "key": "isQObject", "value": "%{JS: [ 'QObject', 'QWidget', 'QMainWindow', 'QDeclarativeItem', 'QQuickItem'].indexOf(value('Base')) >= 0 }" }, + { "key": "GUARD", "value": "%{JS: Cpp.classToHeaderGuard(value('Class'), Util.suffix(value('HdrFileName')))}" }, + { "key": "SharedDataInit", "value": "%{JS: (value('IncludeQSharedData')) ? 'data(new %{CN}Data)' : '' }" } ], "pages": @@ -49,7 +49,7 @@ { "name": "BaseEdit", "type": "LineEdit", - "enabled": "%{JS: '%{BaseCB}' === ''}", + "enabled": "%{JS: value('BaseCB') === ''}", "mandatory": false, "data": { @@ -71,7 +71,7 @@ { "checkedValue": "QObject", "uncheckedValue": "", - "checked": "%{JS: '%{BaseCB}' === 'QObject'}" + "checked": "%{JS: value('BaseCB') === 'QObject'}" } }, { @@ -82,7 +82,7 @@ { "checkedValue": "QWidget", "uncheckedValue": "", - "checked": "%{JS: '%{BaseCB}' === 'QWidget'}" + "checked": "%{JS: value('BaseCB') === 'QWidget'}" } }, { @@ -93,7 +93,7 @@ { "checkedValue": "QMainWindow", "uncheckedValue": "", - "checked": "%{JS: '%{BaseCB}' === 'QMainWindow'}" + "checked": "%{JS: value('BaseCB') === 'QMainWindow'}" } }, { @@ -104,7 +104,7 @@ { "checkedValue": "QDeclarativeItem", "uncheckedValue": "", - "checked": "%{JS: '%{BaseCB}' === 'QDeclarativeItem'}" + "checked": "%{JS: value('BaseCB') === 'QDeclarativeItem'}" } }, { @@ -115,7 +115,7 @@ { "checkedValue": "QQuickItem", "uncheckedValue": "", - "checked": "%{JS: '%{BaseCB}' === 'QQuickItem'}" + "checked": "%{JS: value('BaseCB') === 'QQuickItem'}" } }, { @@ -139,14 +139,14 @@ "type": "LineEdit", "trDisplayName": "Header file:", "mandatory": true, - "data": { "trText": "%{JS: Cpp.classToFileName('%{Class}', '%{JS: Util.preferredSuffix('text/x-c++hdr')}')}" } + "data": { "trText": "%{JS: Cpp.classToFileName(value('Class'), Util.preferredSuffix('text/x-c++hdr'))}" } }, { "name": "SrcFileName", "type": "LineEdit", "trDisplayName": "Source file:", "mandatory": true, - "data": { "trText": "%{JS: Cpp.classToFileName('%{Class}', '%{JS: Util.preferredSuffix('text/x-c++src')}')}" } + "data": { "trText": "%{JS: Cpp.classToFileName(value('Class'), Util.preferredSuffix('text/x-c++src'))}" } }, { "name": "Path", @@ -155,7 +155,7 @@ "mandatory": true, "data": { - "kind": "existingDirectory", + "kind": "directory", "basePath": "%{InitialPath}", "path": "%{InitialPath}" } diff --git a/share/qtcreator/templates/wizards/classes/itemmodel/itemmodel.cpp b/share/qtcreator/templates/wizards/classes/itemmodel/itemmodel.cpp index a8cdf3164a..4a438f48e4 100644 --- a/share/qtcreator/templates/wizards/classes/itemmodel/itemmodel.cpp +++ b/share/qtcreator/templates/wizards/classes/itemmodel/itemmodel.cpp @@ -1,5 +1,5 @@ %{Cpp:LicenseTemplate}\ -#include "%{HdrFileName}" +#include "%{JS: Util.relativeFilePath('%{Path}/%{HdrFileName}', '%{Path}' + '/' + Util.path('%{SrcFileName}'))}" %{JS: Cpp.openNamespaces('%{Class}')}\ %{CN}::%{CN}(QObject *parent) diff --git a/share/qtcreator/templates/wizards/classes/itemmodel/listmodel.cpp b/share/qtcreator/templates/wizards/classes/itemmodel/listmodel.cpp index 5d25d88609..b6c9c4b430 100644 --- a/share/qtcreator/templates/wizards/classes/itemmodel/listmodel.cpp +++ b/share/qtcreator/templates/wizards/classes/itemmodel/listmodel.cpp @@ -1,5 +1,5 @@ %{Cpp:LicenseTemplate}\ -#include "%{HdrFileName}" +#include "%{JS: Util.relativeFilePath('%{Path}/%{HdrFileName}', '%{Path}' + '/' + Util.path('%{SrcFileName}'))}" %{JS: Cpp.openNamespaces('%{Class}')}\ %{CN}::%{CN}(QObject *parent) diff --git a/share/qtcreator/templates/wizards/classes/itemmodel/tablemodel.cpp b/share/qtcreator/templates/wizards/classes/itemmodel/tablemodel.cpp index 80bedf5899..cda910e6f7 100644 --- a/share/qtcreator/templates/wizards/classes/itemmodel/tablemodel.cpp +++ b/share/qtcreator/templates/wizards/classes/itemmodel/tablemodel.cpp @@ -1,5 +1,5 @@ %{Cpp:LicenseTemplate}\ -#include "%{HdrFileName}" +#include "%{JS: Util.relativeFilePath('%{Path}/%{HdrFileName}', '%{Path}' + '/' + Util.path('%{SrcFileName}'))}" %{JS: Cpp.openNamespaces('%{Class}')}\ %{CN}::%{CN}(QObject *parent) diff --git a/share/qtcreator/templates/wizards/classes/itemmodel/wizard.json b/share/qtcreator/templates/wizards/classes/itemmodel/wizard.json index b6b70ba245..1e0cd06e19 100644 --- a/share/qtcreator/templates/wizards/classes/itemmodel/wizard.json +++ b/share/qtcreator/templates/wizards/classes/itemmodel/wizard.json @@ -6,15 +6,15 @@ "trDescription": "Creates a Qt item model.", "trDisplayName": "Qt Item Model", "trDisplayCategory": "Qt", - "enabled": "%{JS: [ %{Plugins} ].indexOf('CppEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('CppEditor') >= 0}", "options": [ { "key": "TargetPath", "value": "%{Path}" }, { "key": "HdrPath", "value": "%{Path}/%{HdrFileName}" }, { "key": "SrcPath", "value": "%{Path}/%{SrcFileName}" }, - { "key": "CN", "value": "%{JS: Cpp.className('%{Class}')}" }, - { "key": "GUARD", "value": "%{JS: Cpp.classToHeaderGuard('%{Class}', '%{JS: Util.preferredSuffix('text/x-c++hdr')}')}" } + { "key": "CN", "value": "%{JS: Cpp.className(value('Class'))}" }, + { "key": "GUARD", "value": "%{JS: Cpp.classToHeaderGuard(value('Class'), Util.preferredSuffix('text/x-c++hdr'))}" } ], "pages": @@ -92,14 +92,14 @@ "type": "LineEdit", "trDisplayName": "Header file:", "mandatory": true, - "data": { "trText": "%{JS: Cpp.classToFileName('%{Class}', '%{JS: Util.preferredSuffix('text/x-c++hdr')}')}" } + "data": { "trText": "%{JS: Cpp.classToFileName(value('Class'), Util.preferredSuffix('text/x-c++hdr'))}" } }, { "name": "SrcFileName", "type": "LineEdit", "trDisplayName": "Source file:", "mandatory": true, - "data": { "trText": "%{JS: Cpp.classToFileName('%{Class}', '%{JS: Util.preferredSuffix('text/x-c++src')}')}" } + "data": { "trText": "%{JS: Cpp.classToFileName(value('Class'), Util.preferredSuffix('text/x-c++src'))}" } }, { "name": "Path", @@ -108,7 +108,7 @@ "mandatory": true, "data": { - "kind": "existingDirectory", + "kind": "directory", "basePath": "%{InitialPath}", "path": "%{InitialPath}" } @@ -131,7 +131,7 @@ { "source": "itemmodel.h", "target": "%{HdrPath}", - "condition": "%{JS: '%{Base}' === 'QAbstractItemModel'}", + "condition": "%{JS: value('Base') === 'QAbstractItemModel'}", "options": [ { "key": "Cpp:License:FileName", "value": "%{HdrFileName}" }, { "key": "Cpp:License:ClassName", "value": "%{CN}" } @@ -141,7 +141,7 @@ "source": "itemmodel.cpp", "target": "%{SrcPath}", "openInEditor": true, - "condition": "%{JS: '%{Base}' === 'QAbstractItemModel'}", + "condition": "%{JS: value('Base') === 'QAbstractItemModel'}", "options": [ { "key": "Cpp:License:FileName", "value": "%{SrcFileName}" }, { "key": "Cpp:License:ClassName", "value": "%{CN}" } @@ -150,7 +150,7 @@ { "source": "tablemodel.h", "target": "%{HdrPath}", - "condition": "%{JS: '%{Base}' === 'QAbstractTableModel'}", + "condition": "%{JS: value('Base') === 'QAbstractTableModel'}", "options": [ { "key": "Cpp:License:FileName", "value": "%{HdrFileName}" }, { "key": "Cpp:License:ClassName", "value": "%{CN}" } @@ -160,7 +160,7 @@ "source": "tablemodel.cpp", "target": "%{SrcPath}", "openInEditor": true, - "condition": "%{JS: '%{Base}' === 'QAbstractTableModel'}", + "condition": "%{JS: value('Base') === 'QAbstractTableModel'}", "options": [ { "key": "Cpp:License:FileName", "value": "%{SrcFileName}" }, { "key": "Cpp:License:ClassName", "value": "%{CN}" } @@ -169,7 +169,7 @@ { "source": "listmodel.h", "target": "%{HdrPath}", - "condition": "%{JS: '%{Base}' === 'QAbstractListModel'}", + "condition": "%{JS: value('Base') === 'QAbstractListModel'}", "options": [ { "key": "Cpp:License:FileName", "value": "%{HdrFileName}" }, { "key": "Cpp:License:ClassName", "value": "%{CN}" } @@ -179,7 +179,7 @@ "source": "listmodel.cpp", "target": "%{SrcPath}", "openInEditor": true, - "condition": "%{JS: '%{Base}' === 'QAbstractListModel'}", + "condition": "%{JS: value('Base') === 'QAbstractListModel'}", "options": [ { "key": "Cpp:License:FileName", "value": "%{SrcFileName}" }, { "key": "Cpp:License:ClassName", "value": "%{CN}" } diff --git a/share/qtcreator/templates/wizards/classes/python/wizard.json b/share/qtcreator/templates/wizards/classes/python/wizard.json index 6d1d72c63b..233a8bac7a 100644 --- a/share/qtcreator/templates/wizards/classes/python/wizard.json +++ b/share/qtcreator/templates/wizards/classes/python/wizard.json @@ -7,11 +7,11 @@ "trDisplayName": "Python Class", "trDisplayCategory": "Python", "icon": "../../files/python/icon.png", - "enabled": "%{JS: [ %{Plugins} ].indexOf('PythonEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('PythonEditor') >= 0}", "options": [ - { "key": "Base", "value":"%{JS: ( '%{BaseCB}' === '' ) ? '%{BaseEdit}' : '%{BaseCB}'}" }, + { "key": "Base", "value":"%{JS: value('BaseCB') === '' ? value('BaseEdit') : value('BaseCB')}" }, { "key": "Imports", "value": "%{ImportQtCore}%{ImportQtWidgets}%{ImportQtDeclarative}"} ], @@ -52,7 +52,7 @@ { "name": "BaseEdit", "type": "LineEdit", - "enabled": "%{JS: '%{BaseCB}' === ''}", + "enabled": "%{JS: value('BaseCB') === ''}", "mandatory": false, "data": { "trText": "%{BaseCB}" } }, @@ -71,7 +71,7 @@ { "checkedValue": "QtCore", "uncheckedValue": "", - "checked": "%{JS: '%{Base}' !== ''}" + "checked": "%{JS: value('Base') !== ''}" } }, { @@ -82,7 +82,7 @@ { "checkedValue": "QtWidgets", "uncheckedValue": "", - "checked": "%{JS: '%{Base}' === 'QWidget'}" + "checked": "%{JS: value('Base') === 'QWidget'}" } }, { @@ -93,7 +93,7 @@ { "checkedValue": "QtQuick", "uncheckedValue": "", - "checked": "%{JS: '%{Base}' === 'QQuickItem'}" + "checked": "%{JS: value('Base') === 'QQuickItem'}" } }, { @@ -108,7 +108,7 @@ "type": "LineEdit", "trDisplayName": "Source file:", "mandatory": true, - "data": { "trText": "%{JS: Util.fileName('%{Class}', '%{JS: Util.preferredSuffix('text/x-python')}')}" } + "data": { "trText": "%{JS: Util.fileName(value('Class'), Util.preferredSuffix('text/x-python'))}" } }, { "name": "TargetPath", @@ -117,7 +117,7 @@ "mandatory": true, "data": { - "kind": "existingDirectory", + "kind": "directory", "basePath": "%{InitialPath}", "path": "%{InitialPath}" } diff --git a/share/qtcreator/templates/wizards/classes/qtquickui/wizard.json b/share/qtcreator/templates/wizards/classes/qtquickui/wizard.json index a1d4338994..e8bd200d75 100644 --- a/share/qtcreator/templates/wizards/classes/qtquickui/wizard.json +++ b/share/qtcreator/templates/wizards/classes/qtquickui/wizard.json @@ -8,7 +8,7 @@ "trDisplayCategory": "Qt", "iconText": "ui.qml", "featuresRequired": [ "QtSupport.Wizards.FeatureQtQuick.UiFiles" ], - "enabled": "%{JS: [ %{Plugins} ].indexOf('QmlJSEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('QmlJSEditor') >= 0}", "options" : [ { "key": "QmlFile", "value": "%{Class}.%{JS: Util.preferredSuffix('text/x-qml')}" }, @@ -57,7 +57,7 @@ "mandatory": true, "data": { - "kind": "existingDirectory", + "kind": "directory", "basePath": "%{InitialPath}", "path": "%{InitialPath}" } diff --git a/share/qtcreator/templates/wizards/files/cppheader/wizard.json b/share/qtcreator/templates/wizards/files/cppheader/wizard.json index bda6770d09..efb0ea8119 100644 --- a/share/qtcreator/templates/wizards/files/cppheader/wizard.json +++ b/share/qtcreator/templates/wizards/files/cppheader/wizard.json @@ -7,9 +7,9 @@ "trDisplayName": "C++ Header File", "trDisplayCategory": "C++", "iconText": "h", - "enabled": "%{JS: [ %{Plugins} ].indexOf('CppEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('CppEditor') >= 0}", - "options": { "key": "FileName", "value": "%{JS: Cpp.fileName('%{TargetPath}', '%{JS: Util.preferredSuffix('text/x-c++hdr')}')}" }, + "options": { "key": "FileName", "value": "%{JS: Util.fileName(value('TargetPath'), Util.preferredSuffix('text/x-c++hdr'))}" }, "pages" : [ @@ -33,7 +33,7 @@ "source": "file.h", "target": "%{FileName}", "openInEditor": true, - "options": { "key": "Cpp:License:FileName", "value": "%{JS: Util.fileName('%{FileName}')}" } + "options": { "key": "Cpp:License:FileName", "value": "%{JS: Util.fileName(value('FileName'))}" } } } ] diff --git a/share/qtcreator/templates/wizards/files/cppsource/wizard.json b/share/qtcreator/templates/wizards/files/cppsource/wizard.json index 7eebc282b5..775cd892ab 100644 --- a/share/qtcreator/templates/wizards/files/cppsource/wizard.json +++ b/share/qtcreator/templates/wizards/files/cppsource/wizard.json @@ -7,9 +7,9 @@ "trDisplayName": "C++ Source File", "trDisplayCategory": "C++", "iconText": "cpp", - "enabled": "%{JS: [ %{Plugins} ].indexOf('CppEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('CppEditor') >= 0}", - "options": { "key": "FileName", "value": "%{JS: Cpp.fileName('%{TargetPath}', '%{JS: Util.preferredSuffix('text/x-c++src')}')}" }, + "options": { "key": "FileName", "value": "%{JS: Util.fileName(value('TargetPath'), Util.preferredSuffix('text/x-c++src'))}" }, "pages" : [ @@ -33,7 +33,7 @@ "source": "file.cpp", "target": "%{FileName}", "openInEditor": true, - "options": { "key": "Cpp:License:FileName", "value": "%{JS: Util.fileName('%{FileName}')}" } + "options": { "key": "Cpp:License:FileName", "value": "%{JS: Util.fileName(value('FileName'))}" } } } ] diff --git a/share/qtcreator/templates/wizards/files/form/file.ui b/share/qtcreator/templates/wizards/files/form/file.ui index d83113033f..1ee54204a8 100644 --- a/share/qtcreator/templates/wizards/files/form/file.ui +++ b/share/qtcreator/templates/wizards/files/form/file.ui @@ -1 +1 @@ -%{JS: [ %{FormContents} ].join('\n')}\ +%{FormContents} diff --git a/share/qtcreator/templates/wizards/files/form/wizard.json b/share/qtcreator/templates/wizards/files/form/wizard.json index 26d15d2b59..ec5fd422a3 100644 --- a/share/qtcreator/templates/wizards/files/form/wizard.json +++ b/share/qtcreator/templates/wizards/files/form/wizard.json @@ -7,12 +7,12 @@ "trDisplayName": "Qt Designer Form", "trDisplayCategory": "Qt", "iconText": "ui", - "enabled": "%{JS: [ %{Plugins} ].indexOf('Designer') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('Designer') >= 0}", "options": [ - { "key": "UiClass", "value": "%{JS: QtSupport.uiClassName([ %{FormContents} ].join('\\n'))}" }, + { "key": "UiClass", "value": "%{JS: QtSupport.uiClassName(value('FormContents'))}" }, { "key": "Extension", "value": "%{JS: Util.preferredSuffix('application/x-designer')}"}, - { "key": "InitialFileName", "value": "%{JS: Cpp.classToFileName('%{UiClass}', '%{Extension}') }" } + { "key": "InitialFileName", "value": "%{JS: Cpp.classToFileName(value('UiClass'), value('Extension')) }" } ], "pages": @@ -41,7 +41,7 @@ "data": { "source": "file.ui", - "target": "%{JS: Cpp.fileName('%{TargetPath}', '%{Extension}')}", + "target": "%{JS: Util.fileName(value('TargetPath'), value('Extension'))}", "openInEditor": true } } diff --git a/share/qtcreator/templates/wizards/files/glsl/gl/fragment/wizard.json b/share/qtcreator/templates/wizards/files/glsl/gl/fragment/wizard.json index eb5e994782..900e4f8f68 100644 --- a/share/qtcreator/templates/wizards/files/glsl/gl/fragment/wizard.json +++ b/share/qtcreator/templates/wizards/files/glsl/gl/fragment/wizard.json @@ -8,7 +8,7 @@ "trDisplayCategory": "GLSL", "iconText": "frag", "platformIndependent": true, - "enabled": "%{JS: [ %{Plugins} ].indexOf('GLSLEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('GLSLEditor') >= 0}", "pages" : [ @@ -30,7 +30,7 @@ "data": { "source": "file.frag", - "target": "%{JS: Cpp.fileName('%{TargetPath}', '%{JS: Util.preferredSuffix('text/x-glsl-frag')}')}", + "target": "%{JS: Util.fileName(value('TargetPath'), Util.preferredSuffix('text/x-glsl-frag'))}", "openInEditor": true } } diff --git a/share/qtcreator/templates/wizards/files/glsl/gl/vertex/wizard.json b/share/qtcreator/templates/wizards/files/glsl/gl/vertex/wizard.json index bd76a76d6b..38d2df2947 100644 --- a/share/qtcreator/templates/wizards/files/glsl/gl/vertex/wizard.json +++ b/share/qtcreator/templates/wizards/files/glsl/gl/vertex/wizard.json @@ -8,7 +8,7 @@ "trDisplayCategory": "GLSL", "iconText": "vert", "platformIndependent": true, - "enabled": "%{JS: [ %{Plugins} ].indexOf('GLSLEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('GLSLEditor') >= 0}", "pages" : [ @@ -30,7 +30,7 @@ "data": { "source": "file.vert", - "target": "%{JS: Cpp.fileName('%{TargetPath}', '%{JS: Util.preferredSuffix('text/x-glsl-vert')}')}", + "target": "%{JS: Util.fileName(value('TargetPath'), Util.preferredSuffix('text/x-glsl-vert'))}", "openInEditor": true } } diff --git a/share/qtcreator/templates/wizards/files/glsl/gles/fragment/wizard.json b/share/qtcreator/templates/wizards/files/glsl/gles/fragment/wizard.json index c95b336aea..a993a3cfce 100644 --- a/share/qtcreator/templates/wizards/files/glsl/gles/fragment/wizard.json +++ b/share/qtcreator/templates/wizards/files/glsl/gles/fragment/wizard.json @@ -8,7 +8,7 @@ "trDisplayCategory": "GLSL", "iconText": "fsh", "platformIndependent": true, - "enabled": "%{JS: [ %{Plugins} ].indexOf('GLSLEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('GLSLEditor') >= 0}", "pages" : [ @@ -30,7 +30,7 @@ "data": { "source": "file.fsh", - "target": "%{JS: Cpp.fileName('%{TargetPath}', '%{JS: Util.preferredSuffix('text/x-glsl-es-frag')}')}", + "target": "%{JS: Util.fileName(value('TargetPath'), Util.preferredSuffix('text/x-glsl-es-frag'))}", "openInEditor": true } } diff --git a/share/qtcreator/templates/wizards/files/glsl/gles/vertex/wizard.json b/share/qtcreator/templates/wizards/files/glsl/gles/vertex/wizard.json index 68d430d29d..54231aadd5 100644 --- a/share/qtcreator/templates/wizards/files/glsl/gles/vertex/wizard.json +++ b/share/qtcreator/templates/wizards/files/glsl/gles/vertex/wizard.json @@ -8,7 +8,7 @@ "trDisplayCategory": "GLSL", "iconText": "vsh", "platformIndependent": true, - "enabled": "%{JS: [ %{Plugins} ].indexOf('GLSLEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('GLSLEditor') >= 0}", "pages" : [ @@ -30,7 +30,7 @@ "data": { "source": "file.vsh", - "target": "%{JS: Cpp.fileName('%{TargetPath}', '%{JS: Util.preferredSuffix('text/x-glsl-es-vert')}')}", + "target": "%{JS: Util.fileName(value('TargetPath'), Util.preferredSuffix('text/x-glsl-es-vert'))}", "openInEditor": true } } diff --git a/share/qtcreator/templates/wizards/files/java/wizard.json b/share/qtcreator/templates/wizards/files/java/wizard.json index 427dc84e16..6341319c6b 100644 --- a/share/qtcreator/templates/wizards/files/java/wizard.json +++ b/share/qtcreator/templates/wizards/files/java/wizard.json @@ -7,9 +7,9 @@ "trDisplayName": "Java File", "trDisplayCategory": "Java", "iconText": "java", - "enabled": "%{JS: [ %{Plugins} ].indexOf('Android') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('Android') >= 0}", - "options": [ { "key": "ClassName", "value": "%{JS: '%{FileName}'.charAt(0).toUpperCase() + '%{FileName}'.substr(1)}" } ], + "options": [ { "key": "ClassName", "value": "%{JS: value('FileName').charAt(0).toUpperCase() + value('FileName').substr(1).replace(/\\.java$/,'')}" } ], "pages" : [ @@ -31,7 +31,7 @@ "data": { "source": "source.java", - "target": "%{JS: Util.fileName('%{Path}/%{ClassName}', '%{JS: Util.preferredSuffix('text/x-java')}')}", + "target": "%{JS: Util.fileName(value('Path') + '/' + value('ClassName'), Util.preferredSuffix('text/x-java'))}", "openInEditor": true } } diff --git a/share/qtcreator/templates/wizards/files/js/wizard.json b/share/qtcreator/templates/wizards/files/js/wizard.json index 62d3211cda..d47721bb46 100644 --- a/share/qtcreator/templates/wizards/files/js/wizard.json +++ b/share/qtcreator/templates/wizards/files/js/wizard.json @@ -7,7 +7,7 @@ "trDisplayName": "JS File", "trDisplayCategory": "Qt", "iconText": "js", - "enabled": "%{JS: [ %{Plugins} ].indexOf('QmlJSEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('QmlJSEditor') >= 0}", "pages" : [ @@ -47,7 +47,7 @@ "data": { "source": "file.js", - "target": "%{JS: Util.fileName('%{TargetPath}', '%{JS: Util.preferredSuffix('application/javascript')}')}", + "target": "%{JS: Util.fileName(value('TargetPath'), Util.preferredSuffix('application/javascript'))}", "openInEditor": true } } diff --git a/share/qtcreator/templates/wizards/files/modeling/model/wizard.json b/share/qtcreator/templates/wizards/files/modeling/model/wizard.json index 2f8cff689a..c971c8bf9d 100644 --- a/share/qtcreator/templates/wizards/files/modeling/model/wizard.json +++ b/share/qtcreator/templates/wizards/files/modeling/model/wizard.json @@ -8,12 +8,12 @@ "trDisplayCategory": "Modeling", "iconText": "qmodel", "platformIndependent": true, - "enabled": "%{JS: [ %{Plugins} ].indexOf('ModelEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('ModelEditor') >= 0}", "options": [ - { "key": "TargetPath", "value": "%{JS: Util.fileName('%{Location}/%{FileName}', '%{JS: Util.preferredSuffix('text/vnd.qtcreator.model')}')}" }, - { "key": "FileName", "value": "%{JS: Modeling.elementNameToFileName('%{Name}')}" } + { "key": "TargetPath", "value": "%{JS: Util.fileName(value('Location') + '/' + value('FileName'), Util.preferredSuffix('text/vnd.qtcreator.model'))}" }, + { "key": "FileName", "value": "%{JS: Modeling.elementNameToFileName(value('Name'))}" } ], "pages" : @@ -34,11 +34,11 @@ "name": "Location", "trDisplayName": "Location:", "type": "PathChooser", - "isComplete": "%{JS: '%{Location}' === '' || !Util.exists('%{TargetPath}')}", - "trIncompleteMessage": "\"%{JS: Util.toNativeSeparators('%{TargetPath}')}\" exists in the filesystem.", + "isComplete": "%{JS: value('Location') === '' || !Util.exists(value('TargetPath'))}", + "trIncompleteMessage": "\"%{JS: Util.toNativeSeparators(value('TargetPath'))}\" exists in the filesystem.", "data": { - "kind": "existingDirectory", + "kind": "directory", "basePath": "%{InitialPath}", "path": "%{InitialPath}" } diff --git a/share/qtcreator/templates/wizards/files/modeling/scratch/wizard.json b/share/qtcreator/templates/wizards/files/modeling/scratch/wizard.json index 71bad75ddf..8092ba6021 100644 --- a/share/qtcreator/templates/wizards/files/modeling/scratch/wizard.json +++ b/share/qtcreator/templates/wizards/files/modeling/scratch/wizard.json @@ -8,7 +8,7 @@ "trDisplayCategory": "Modeling", "iconText": "qmodel", "platformIndependent": true, - "enabled": "%{JS: [ %{Plugins} ].indexOf('ModelEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('ModelEditor') >= 0}", "options": [ { "key": "TargetPath", "value": "%{JS: Util.mktemp('model-XXXXXX.qmodel')}" } ], diff --git a/share/qtcreator/templates/wizards/files/nim/wizard.json b/share/qtcreator/templates/wizards/files/nim/wizard.json index 953df6a847..723531ced5 100644 --- a/share/qtcreator/templates/wizards/files/nim/wizard.json +++ b/share/qtcreator/templates/wizards/files/nim/wizard.json @@ -7,7 +7,7 @@ "trDisplayName": "Nim File", "trDisplayCategory": "Nim", "icon": "../../projects/nim/icon.png", - "enabled": "%{JS: [ %{Plugins} ].indexOf('Nim') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('Nim') >= 0}", "pages" : [ @@ -29,7 +29,7 @@ "data": { "source": "file.nim", - "target": "%{JS: Util.fileName('%{TargetPath}', 'nim')}", + "target": "%{JS: Util.fileName(value('TargetPath'), 'nim')}", "openInEditor": true } } diff --git a/share/qtcreator/templates/wizards/files/nimscript/wizard.json b/share/qtcreator/templates/wizards/files/nimscript/wizard.json index 62aba314cd..15f366773b 100644 --- a/share/qtcreator/templates/wizards/files/nimscript/wizard.json +++ b/share/qtcreator/templates/wizards/files/nimscript/wizard.json @@ -7,7 +7,7 @@ "trDisplayName": "Nim Script File", "trDisplayCategory": "Nim", "icon": "../../projects/nim/icon.png", - "enabled": "%{JS: [ %{Plugins} ].indexOf('Nim') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('Nim') >= 0}", "pages" : [ @@ -29,7 +29,7 @@ "data": { "source": "file.nims", - "target": "%{JS: Util.fileName('%{TargetPath}', 'nims')}", + "target": "%{JS: Util.fileName(value('TargetPath'), 'nims')}", "openInEditor": true } } diff --git a/share/qtcreator/templates/wizards/files/python/wizard.json b/share/qtcreator/templates/wizards/files/python/wizard.json index d4a6cfd012..262de2d37b 100644 --- a/share/qtcreator/templates/wizards/files/python/wizard.json +++ b/share/qtcreator/templates/wizards/files/python/wizard.json @@ -7,7 +7,7 @@ "trDisplayName": "Python File", "trDisplayCategory": "Python", "icon": "icon.png", - "enabled": "%{JS: [ %{Plugins} ].indexOf('PythonEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('PythonEditor') >= 0}", "pages" : [ @@ -29,7 +29,7 @@ "data": { "source": "file.py", - "target": "%{JS: Util.fileName('%{TargetPath}', '%{JS: Util.preferredSuffix('text/x-python')}')}", + "target": "%{JS: Util.fileName(value('TargetPath'), Util.preferredSuffix('text/x-python'))}", "openInEditor": true } } diff --git a/share/qtcreator/templates/wizards/files/qrc/wizard.json b/share/qtcreator/templates/wizards/files/qrc/wizard.json index bbbd8e98f9..578eed58a1 100644 --- a/share/qtcreator/templates/wizards/files/qrc/wizard.json +++ b/share/qtcreator/templates/wizards/files/qrc/wizard.json @@ -7,7 +7,7 @@ "trDisplayName": "Qt Resource File", "trDisplayCategory": "Qt", "iconText": "qrc", - "enabled": "%{JS: [ %{Plugins} ].indexOf('ResourceEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('ResourceEditor') >= 0}", "pages" : [ @@ -29,7 +29,7 @@ "data": { "source": "file.qrc", - "target": "%{JS: Cpp.fileName('%{TargetPath}', '%{JS: Util.preferredSuffix('application/vnd.qt.xml.resource')}')}", + "target": "%{JS: Util.fileName(value('TargetPath'), Util.preferredSuffix('application/vnd.qt.xml.resource'))}", "openInEditor": true } } diff --git a/share/qtcreator/templates/wizards/files/qtquick2/wizard.json b/share/qtcreator/templates/wizards/files/qtquick2/wizard.json index 544368b173..ead52b1687 100644 --- a/share/qtcreator/templates/wizards/files/qtquick2/wizard.json +++ b/share/qtcreator/templates/wizards/files/qtquick2/wizard.json @@ -7,7 +7,7 @@ "trDisplayName": "QML File (Qt Quick 2)", "trDisplayCategory": "Qt", "iconText": "qml", - "enabled": "%{JS: [ %{Plugins} ].indexOf('QmlJSEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('QmlJSEditor') >= 0}", "pages" : [ @@ -29,7 +29,7 @@ "data": { "source": "file.qml.tpl", - "target": "%{JS: Util.fileName('%{TargetPath}', '%{JS: Util.preferredSuffix('text/x-qml')}')}", + "target": "%{JS: Util.fileName(value('TargetPath'), Util.preferredSuffix('text/x-qml'))}", "openInEditor": true } } diff --git a/share/qtcreator/templates/wizards/files/scratch/wizard.json b/share/qtcreator/templates/wizards/files/scratch/wizard.json index 6508db6aa3..aa0efb0e10 100644 --- a/share/qtcreator/templates/wizards/files/scratch/wizard.json +++ b/share/qtcreator/templates/wizards/files/scratch/wizard.json @@ -7,7 +7,7 @@ "trDisplayName": "Scratch Buffer", "trDisplayCategory": "General", "platformIndependent": true, - "enabled": "%{JS: [ %{Plugins} ].indexOf('TextEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('TextEditor') >= 0}", "options": [ { "key": "TargetPath", "value": "%{JS: Util.mktemp('scratch-XXXXXX.txt')}" } ], diff --git a/share/qtcreator/templates/wizards/files/scxml/wizard.json b/share/qtcreator/templates/wizards/files/scxml/wizard.json index 4e9e870637..36bbda7b71 100644 --- a/share/qtcreator/templates/wizards/files/scxml/wizard.json +++ b/share/qtcreator/templates/wizards/files/scxml/wizard.json @@ -8,11 +8,11 @@ "trDisplayCategory": "Modeling", "iconText": "scxml", "platformIndependent": true, - "enabled": "%{JS: [ %{Plugins} ].indexOf('ScxmlEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('ScxmlEditor') >= 0}", "options": [ - { "key": "TargetPath", "value": "%{JS: Util.fileName('%{Location}/%{FileName}', '%{JS: Util.preferredSuffix('application/scxml+xml')}')}" }, + { "key": "TargetPath", "value": "%{JS: Util.fileName(value('Location') + '/' + value('FileName'), Util.preferredSuffix('application/scxml+xml'))}" }, { "key": "FileName", "value": "%{Name}" } ], @@ -34,11 +34,11 @@ "name": "Location", "trDisplayName": "Location:", "type": "PathChooser", - "isComplete": "%{JS: '%{Location}' === '' || !Util.exists('%{TargetPath}')}", - "trIncompleteMessage": "\"%{JS: Util.toNativeSeparators('%{TargetPath}')}\" exists in the filesystem.", + "isComplete": "%{JS: value('Location') === '' || !Util.exists(value('TargetPath'))}", + "trIncompleteMessage": "\"%{JS: Util.toNativeSeparators(value('TargetPath'))}\" exists in the filesystem.", "data": { - "kind": "existingDirectory", + "kind": "directory", "basePath": "%{InitialPath}", "path": "%{InitialPath}" } diff --git a/share/qtcreator/templates/wizards/files/text/wizard.json b/share/qtcreator/templates/wizards/files/text/wizard.json index 11e0577a2d..b983401ef3 100644 --- a/share/qtcreator/templates/wizards/files/text/wizard.json +++ b/share/qtcreator/templates/wizards/files/text/wizard.json @@ -8,7 +8,7 @@ "trDisplayCategory": "General", "iconText": "txt", "platformIndependent": true, - "enabled": "%{JS: [ %{Plugins} ].indexOf('TextEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('TextEditor') >= 0}", "pages" : [ diff --git a/share/qtcreator/templates/wizards/global/lib.png b/share/qtcreator/templates/wizards/global/lib.png Binary files differnew file mode 100644 index 0000000000..52cb73e382 --- /dev/null +++ b/share/qtcreator/templates/wizards/global/lib.png diff --git a/share/qtcreator/templates/wizards/global/lib@2x.png b/share/qtcreator/templates/wizards/global/lib@2x.png Binary files differnew file mode 100644 index 0000000000..c959779b02 --- /dev/null +++ b/share/qtcreator/templates/wizards/global/lib@2x.png diff --git a/share/qtcreator/templates/wizards/projects/consoleapp/CMakeLists.txt b/share/qtcreator/templates/wizards/projects/consoleapp/CMakeLists.txt index 4beef640b7..ce63061d75 100644 --- a/share/qtcreator/templates/wizards/projects/consoleapp/CMakeLists.txt +++ b/share/qtcreator/templates/wizards/projects/consoleapp/CMakeLists.txt @@ -1,12 +1,17 @@ -cmake_minimum_required(VERSION 3.0.0) +cmake_minimum_required(VERSION 3.5) -project(%{ProjectName} VERSION 0.1 LANGUAGES CXX) +project(%{ProjectName} LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) -find_package(Qt5Core) +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) -add_executable(${PROJECT_NAME} "%{CppFileName}") +find_package(Qt5Core) -target_link_libraries(${PROJECT_NAME} Qt5::Core) +add_executable(%{ProjectName} %{CppFileName}) +target_link_libraries(%{ProjectName} Qt5::Core) diff --git a/share/qtcreator/templates/wizards/projects/consoleapp/wizard.json b/share/qtcreator/templates/wizards/projects/consoleapp/wizard.json index b40d529169..bee602c87d 100644 --- a/share/qtcreator/templates/wizards/projects/consoleapp/wizard.json +++ b/share/qtcreator/templates/wizards/projects/consoleapp/wizard.json @@ -8,13 +8,13 @@ "trDisplayCategory": "Application", "icon": "../../global/consoleapplication.png", "featuresRequired": [ "QtSupport.Wizards.FeatureQt" ], - "enabled": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0 || [ %{Plugins} ].indexOf('QbsProjectManager') >= 0 || [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0 || value('Plugins').indexOf('QbsProjectManager') >= 0 || value('Plugins').indexOf('CMakeProjectManager') >= 0}", "options": [ - { "key": "ProjectFile", "value": "%{JS: '%{BuildSystem}' === 'qmake' ? '%{ProFile}' : ('%{BuildSystem}' === 'cmake' ? '%{CMakeFile}' : '%{QbsFile}')}" }, - { "key": "ProFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'pro')}" }, - { "key": "QbsFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'qbs')}" }, + { "key": "ProjectFile", "value": "%{JS: value('BuildSystem') === 'qmake' ? value('ProFile') : (value('BuildSystem') === 'cmake' ? value('CMakeFile') : value('QbsFile'))}" }, + { "key": "ProFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'pro')}" }, + { "key": "QbsFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'qbs')}" }, { "key": "CMakeFile", "value": "%{ProjectDirectory}/CMakeLists.txt" }, { "key": "CppFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src')}" } ], @@ -31,7 +31,7 @@ "trDisplayName": "Define Build System", "trShortTitle": "Build System", "typeId": "Fields", - "enabled": "%{JS: ! %{IsSubproject}}", + "enabled": "%{JS: !value('IsSubproject')}", "data": [ { @@ -46,17 +46,17 @@ { "trKey": "qmake", "value": "qmake", - "condition": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0}" }, { "trKey": "CMake", "value": "cmake", - "condition": "%{JS: [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('CMakeProjectManager') >= 0}" }, { "trKey": "Qbs", "value": "qbs", - "condition": "%{JS: [ %{Plugins} ].indexOf('QbsProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('QbsProjectManager') >= 0}" } ] } @@ -67,7 +67,7 @@ "trDisplayName": "Kit Selection", "trShortTitle": "Kits", "typeId": "Kits", - "enabled": "%{JS: ! %{IsSubproject}}", + "enabled": "%{JS: !value('IsSubproject')}", "data": { "projectFilePath": "%{ProjectFile}" } }, { @@ -86,18 +86,18 @@ "source": "file.pro", "target": "%{ProFile}", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'qmake'}" + "condition": "%{JS: value('BuildSystem') === 'qmake'}" }, { "source": "CMakeLists.txt", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'cmake'}" + "condition": "%{JS: value('BuildSystem') === 'cmake'}" }, { "source": "file.qbs", "target": "%{QbsFile}", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'qbs'}" + "condition": "%{JS: value('BuildSystem') === 'qbs'}" }, { "source": "main.cpp", @@ -107,7 +107,7 @@ { "source": "../git.ignore", "target": ".gitignore", - "condition": "%{JS: ! %{IsSubproject} && '%{VersionControl}' === 'G.Git'}" + "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}" } ] } diff --git a/share/qtcreator/templates/wizards/projects/cpplibrary/CMakeLists.txt b/share/qtcreator/templates/wizards/projects/cpplibrary/CMakeLists.txt new file mode 100644 index 0000000000..243280b657 --- /dev/null +++ b/share/qtcreator/templates/wizards/projects/cpplibrary/CMakeLists.txt @@ -0,0 +1,35 @@ +cmake_minimum_required(VERSION 3.5) + +project(%{ProjectName} LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) +@if '%{QtModule}' != 'none' +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +@endif +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +@if '%{QtModule}' != 'none' + +find_package(Qt5 COMPONENTS %{QtModuleUpperCase} REQUIRED) +@endif + +add_library(%{ProjectName} %{JS: %{IsStatic} ? 'STATIC' : 'SHARED'} +@if '%{Type}' === 'shared' + %{GlobalHdrFileName} +@endif + %{SrcFileName} + %{HdrFileName} +@if %{IsQtPlugin} + %{PluginJsonFile} +@endif +) +@if '%{QtModule}' != 'none' + +target_link_libraries(%{ProjectName} PRIVATE Qt5::%{QtModuleUpperCase}) +@endif +@if '%{IsShared}' + +target_compile_definitions(%{ProjectName} PRIVATE %{LibraryDefine}) +@endif diff --git a/share/qtcreator/templates/wizards/projects/cpplibrary/lib.cpp b/share/qtcreator/templates/wizards/projects/cpplibrary/lib.cpp new file mode 100644 index 0000000000..6eb6c86faa --- /dev/null +++ b/share/qtcreator/templates/wizards/projects/cpplibrary/lib.cpp @@ -0,0 +1,17 @@ +%{Cpp:LicenseTemplate}\ +#include "%{JS: Util.relativeFilePath('%{Path}/%{HdrFileName}', '%{Path}' + '/' + Util.path('%{SrcFileName}'))}" +%{JS: Cpp.openNamespaces('%{Class}')}\ + +@if ! %{IsQtPlugin} +%{CN}::%{CN}() +{ +} +@else +%{CN}::%{CN}(QObject *parent) + : %{BaseClassName}(parent) +{ +} +%{JS: '%{PluginMethods}'.split('|').map(function(s) { return '\\n' + s.replace(/([a-zA-Z0-9]+\\()/, '%{CN}::$1') + '\\n\{\\n static_assert(false, "You need to implement this function");\\n\}'; \}).join('\\n')}\ + +@endif +%{JS: Cpp.closeNamespaces('%{Class}')}\ diff --git a/share/qtcreator/templates/wizards/projects/cpplibrary/lib.h b/share/qtcreator/templates/wizards/projects/cpplibrary/lib.h new file mode 100644 index 0000000000..ae2c90a313 --- /dev/null +++ b/share/qtcreator/templates/wizards/projects/cpplibrary/lib.h @@ -0,0 +1,46 @@ +%{Cpp:LicenseTemplate}\ +@if '%{Cpp:PragmaOnce}' +#pragma once +@else +#ifndef %{GUARD} +#define %{GUARD} +@endif +@if %{IsShared} + +#include "%{GlobalHdrFileName}" +@elsif %{IsQtPlugin} + +#include <%{BaseClassName}> +@endif +%{JS: Cpp.openNamespaces('%{Class}')}\ + +@if %{IsShared} +class %{LibraryExport} %{CN} +{ +public: + %{CN}(); +}; +@elsif %{IsStatic} +class %{CN} +{ +public: + %{CN}(); +}; +@else +class %{CN} : public %{BaseClassName} +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.%{PluginInterface}" FILE "%{PluginJsonFile}") + +public: + explicit %{CN}(QObject *parent = nullptr); + +private: +%{JS: '%{PluginMethods}'.split('|').map(function(s) { return ' ' + s + ' override;'; \}).join('\\n')} +}; +@endif +%{JS: Cpp.closeNamespaces('%{Class}')}\ +@if ! '%{Cpp:PragmaOnce}' + +#endif // %{GUARD} +@endif diff --git a/share/qtcreator/templates/wizards/projects/cpplibrary/lib_global.h b/share/qtcreator/templates/wizards/projects/cpplibrary/lib_global.h new file mode 100644 index 0000000000..c665cf911c --- /dev/null +++ b/share/qtcreator/templates/wizards/projects/cpplibrary/lib_global.h @@ -0,0 +1,29 @@ +%{Cpp:LicenseTemplate}\ +@if '%{Cpp:PragmaOnce}' +#pragma once +@else +#ifndef %{GLOBAL_GUARD} +#define %{GLOBAL_GUARD} +@endif + +@if '%{QtModule}' != 'none' +#include <QtCore/qglobal.h> +@else +#if defined(_MSC_VER) || defined(WIN64) || defined(_WIN64) || defined(__WIN64__) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) +# define Q_DECL_EXPORT __declspec(dllexport) +# define Q_DECL_IMPORT __declspec(dllimport) +#else +# define Q_DECL_EXPORT __attribute__((visibility("default"))) +# define Q_DECL_IMPORT __attribute__((visibility("default"))) +#endif +@endif + +#if defined(%{LibraryDefine}) +# define %{LibraryExport} Q_DECL_EXPORT +#else +# define %{LibraryExport} Q_DECL_IMPORT +#endif +@if ! '%{Cpp:PragmaOnce}' + +#endif // %{GLOBAL_GUARD} +@endif diff --git a/share/qtcreator/templates/wizards/projects/cpplibrary/project.json b/share/qtcreator/templates/wizards/projects/cpplibrary/project.json new file mode 100644 index 0000000000..1e811388e4 --- /dev/null +++ b/share/qtcreator/templates/wizards/projects/cpplibrary/project.json @@ -0,0 +1,3 @@ +{ + "Keys" : [ ] +} diff --git a/share/qtcreator/templates/wizards/projects/cpplibrary/project.pro b/share/qtcreator/templates/wizards/projects/cpplibrary/project.pro new file mode 100644 index 0000000000..431667ada5 --- /dev/null +++ b/share/qtcreator/templates/wizards/projects/cpplibrary/project.pro @@ -0,0 +1,50 @@ +@if '%{QtModule}' === 'none' +CONFIG -= qt +@elsif '%{QtModule}' === 'core' +QT -= gui +@else +QT += %{QtModule} +@endif + +TEMPLATE = lib +@if %{IsStatic} +CONFIG += staticlib +@elsif %{IsQtPlugin} +CONFIG += plugin +@elsif %{IsShared} +DEFINES += %{LibraryDefine} +@endif + +CONFIG += c++11 + +# 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. +DEFINES += QT_DEPRECATED_WARNINGS + +# You can also make your code fail to compile if it uses deprecated APIs. +# In order to do so, uncomment the following line. +# You can also select to disable deprecated APIs only up to a certain version of Qt. +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + +SOURCES += \\ + %{SrcFileName} + +HEADERS += \\ +@if %{IsShared} + %{GlobalHdrFileName} \\ +@endif + %{HdrFileName} +@if %{IsQtPlugin} + +DISTFILES += %{PluginJsonFile} +@endif + +@if '%{TargetInstallPath}' != '' +# Default rules for deployment. +unix { + target.path = %{TargetInstallPath} +} +!isEmpty(target.path): INSTALLS += target +@endif diff --git a/share/qtcreator/templates/wizards/projects/cpplibrary/wizard.json b/share/qtcreator/templates/wizards/projects/cpplibrary/wizard.json new file mode 100644 index 0000000000..af209105bf --- /dev/null +++ b/share/qtcreator/templates/wizards/projects/cpplibrary/wizard.json @@ -0,0 +1,326 @@ +{ + "version": 1, + "supportedProjectTypes": [ "CMakeProjectManager.CMakeProject", "Qt4ProjectManager.Qt4Project" ], + "id": "H.CppLibrary", + "category": "G.Library", + "trDescription": "Creates a C++ library. This can be used to create:<ul><li>a shared C++ library for use with <tt>QPluginLoader</tt> and runtime (Plugins)</li><li>a shared or static C++ library for use with another project at linktime</li></ul>", + "trDisplayName": "C++ Library", + "trDisplayCategory": "Library", + "icon": "../../global/lib.png", + "enabled": "%{JS: value('Plugins').indexOf('CppEditor') >= 0 && (value('Plugins').indexOf('QmakeProjectManager') >= 0 || value('Plugins').indexOf('CMakeProjectManager') >= 0)}", + + "options": + [ + { "key": "ProjectFile", "value": "%{JS: value('BuildSystem') === 'qmake' ? value('ProFile') : value('CMakeFile')}" }, + { "key": "ProFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'pro')}" }, + { "key": "CMakeFile", "value": "%{ProjectDirectory}/CMakeLists.txt" }, + { "key": "PluginJsonFile", "value": "%{JS: Util.fileName(value('ProjectName'), 'json')}" }, + { "key": "IsShared", "value": "%{JS: value('Type') === 'shared'}" }, + { "key": "IsStatic", "value": "%{JS: value('Type') === 'static'}" }, + { "key": "IsQtPlugin", "value": "%{JS: value('Type') === 'qtplugin'}" }, + { "key": "BaseClassName", "value": "%{JS: value('BaseClassInfo').BaseClassName }" }, + { "key": "PluginTargetPath", "value": "%{JS: value('BaseClassInfo').PluginTargetPath }" }, + { "key": "PluginInterface", "value": "%{JS: value('BaseClassInfo').PluginInterface }" }, + { "key": "PluginModule", "value": "%{JS: value('BaseClassInfo').PluginModule }" }, + { "key": "PluginMethods", "value": "%{JS: value('BaseClassInfo').PluginMethods }" }, + { "key": "QtModule", "value": "%{JS: value('IsQtPlugin') === 'true' ? value('PluginModule') : value('LibraryQtModule')}" }, + { "key": "QtModuleUpperCase", "value": "%{JS: value('QtModule').charAt(0).toUpperCase() + value('QtModule').slice(1)}" }, + { "key": "LibraryDefine", "value": "%{JS: Cpp.headerGuard(value('ProjectName')) + '_LIBRARY'}" }, + { "key": "LibraryExport", "value": "%{JS: Cpp.headerGuard(value('ProjectName')) + '_EXPORT'}" }, + { "key": "GlobalHdrFileName", "value": "%{JS: Util.fileName(value('ProjectName') + '_global', Util.preferredSuffix('text/x-c++hdr'))}" }, + { "key": "TargetInstallPath", "value": "%{JS: value('IsShared') === 'true' ? '/usr/lib' : (value('IsQtPlugin') && value('PluginTargetPath') ? '$$[QT_INSTALL_PLUGINS]/' + value('PluginTargetPath') : '')}" }, + { "key": "CN", "value": "%{JS: Cpp.className(value('Class'))}" }, + { "key": "GUARD", "value": "%{JS: Cpp.classToHeaderGuard(value('Class'), Util.suffix(value('HdrFileName')))}" }, + { "key": "GLOBAL_GUARD", "value": "%{JS: Cpp.headerGuard(value('GlobalHdrFileName'))}" } + ], + + "pages": + [ + { + "trDisplayName": "Project Location", + "trShortTitle": "Location", + "typeId": "Project", + "data": { "trDescription": "This wizard creates a C++ library project." } + }, + { + "trDisplayName": "Define Build System", + "trShortTitle": "Build System", + "typeId": "Fields", + "enabled": "%{JS: !value('IsSubproject')}", + "data": + [ + { + "name": "BuildSystem", + "trDisplayName": "Build system:", + "type": "ComboBox", + "data": + { + "index": 0, + "items": + [ + { + "trKey": "Qmake", + "value": "qmake", + "condition": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0}" + }, + { + "trKey": "CMake", + "value": "cmake", + "condition": "%{JS: value('Plugins').indexOf('CMakeProjectManager') >= 0}" + } + ] + } + } + ] + }, + { + "trDisplayName": "Define Project Details", + "trShortTitle": "Details", + "typeId": "Fields", + "data": + [ + { + "name": "ClassPageDescription", + "type": "Label", + "data": + { + "trText": "Specify basic information about the classes for which you want to generate skeleton source code files.", + "wordWrap": true + } + }, + { + "name": "Type", + "trDisplayName": "Type:", + "type": "ComboBox", + "data": + { + "index": 0, + "items": + [ + { + "trKey": "Shared Library", + "value": "shared" + }, + { + "trKey": "Statically Linked Library", + "value": "static" + }, + { + "trKey": "Qt Plugin", + "value": "qtplugin" + } + ] + } + }, + { + "name": "Sp0", + "type": "Spacer" + }, + { + "name": "Class", + "trDisplayName": "Class name:", + "mandatory": true, + "type": "LineEdit", + "data": + { + "validator": "(?:(?:[a-zA-Z_][a-zA-Z_0-9]*::)*[a-zA-Z_][a-zA-Z_0-9]*|)", + "trText": "%{JS: value('Type') === 'qtplugin' ? value('BaseClassName').slice(1) : (value('ProjectName').charAt(0).toUpperCase() + value('ProjectName').slice(1))}" + } + }, + { + "name": "BaseClassInfo", + "trDisplayName": "Base class:", + "type": "ComboBox", + "visible": "%{JS: value('Type') === 'qtplugin'}", + "data": + { + "index": 1, + "items": + [ + { + "trKey": "QAccessiblePlugin", + "value": + { + "BaseClassName": "QAccessiblePlugin", + "PluginTargetPath": "accessible", + "PluginInterface": "QAccessibleFactoryInterface", + "PluginModule": "gui", + "PluginMethods": "QAccessibleInterface *create(const QString &key, QObject *object)" + } + }, + { + "trKey": "QGenericPlugin", + "value": + { + "BaseClassName": "QGenericPlugin", + "PluginTargetPath": "generic", + "PluginInterface": "QGenericPluginFactoryInterface", + "PluginModule": "gui", + "PluginMethods": "QObject *create(const QString &name, const QString &spec)" + } + }, + { + "trKey": "QIconEnginePlugin", + "value": + { + "BaseClassName": "QIconEnginePlugin", + "PluginTargetPath": "imageformats", + "PluginInterface": "QIconEngineFactoryInterface", + "PluginModule": "gui", + "PluginMethods": "QIconEngine *create(const QString &filename)" + } + }, + { + "trKey": "QImageIOPlugin", + "value": + { + "BaseClassName": "QImageIOPlugin", + "PluginTargetPath": "imageformats", + "PluginInterface": "QImageIOHandlerFactoryInterface", + "PluginModule": "gui", + "PluginMethods": "QImageIOPlugin::Capabilities capabilities(QIODevice *device, const QByteArray &format) const|QImageIOHandler *create(QIODevice *device, const QByteArray &format) const" + } + }, + { + "trKey": "QScriptExtensionPlugin", + "value": + { + "BaseClassName": "QScriptExtensionPlugin", + "PluginTargetPath": "", + "PluginInterface": "QScriptExtensionInterface", + "PluginModule": "script", + "PluginMethods": "void initialize(const QString &key, QScriptEngine *engine)|QStringList keys() const" + } + }, + { + "trKey": "QSqlDriverPlugin", + "value": + { + "BaseClassName": "QSqlDriverPlugin", + "PluginTargetPath": "sqldrivers", + "PluginInterface": "QSqlDriverFactoryInterface", + "PluginModule": "sql", + "PluginMethods": "QSqlDriver *create(const QString &key)" + } + }, + { + "trKey": "QStylePlugin", + "value": + { + "BaseClassName": "QStylePlugin", + "PluginTargetPath": "styles", + "PluginInterface": "QStyleFactoryInterface", + "PluginModule": "widgets", + "PluginMethods": "QStyle *create(const QString &key)" + } + } + ] + } + }, + { + "name": "LibraryQtModule", + "trDisplayName": "Qt module:", + "type": "ComboBox", + "visible": "%{JS: value('Type') != 'qtplugin'}", + "data": + { + "index": 1, + "items": + [ + { + "trKey": "None", + "value": "none" + }, + { + "trKey": "Core", + "value": "core" + }, + { + "trKey": "Gui", + "value": "gui" + }, + { + "trKey": "Widgets", + "value": "widgets" + } + ] + } + }, + { + "name": "Sp1", + "type": "Spacer" + }, + { + "name": "HdrFileName", + "type": "LineEdit", + "trDisplayName": "Header file:", + "mandatory": true, + "data": { "trText": "%{JS: Cpp.classToFileName(value('Class'), Util.preferredSuffix('text/x-c++hdr'))}" } + }, + { + "name": "SrcFileName", + "type": "LineEdit", + "trDisplayName": "Source file:", + "mandatory": true, + "data": { "trText": "%{JS: Cpp.classToFileName(value('Class'), Util.preferredSuffix('text/x-c++src'))}" } + } + ] + }, + { + "trDisplayName": "Kit Selection", + "trShortTitle": "Kits", + "typeId": "Kits", + "enabled": "%{JS: !value('IsSubproject')}", + "data": { "projectFilePath": "%{ProjectFile}" } + }, + { + "trDisplayName": "Project Management", + "trShortTitle": "Summary", + "typeId": "Summary" + } + ], + "generators": + [ + { + "typeId": "File", + "data": + [ + { + "source": "project.pro", + "target": "%{ProFile}", + "openAsProject": true, + "condition": "%{JS: value('BuildSystem') === 'qmake'}" + }, + { + "source": "CMakeLists.txt", + "openAsProject": true, + "condition": "%{JS: value('BuildSystem') === 'cmake'}" + }, + { + "source": "lib.cpp", + "target": "%{SrcFileName}", + "openInEditor": true + }, + { + "source": "lib.h", + "target": "%{HdrFileName}" + }, + { + "source": "lib_global.h", + "target": "%{GlobalHdrFileName}", + "condition": "%{JS: value('Type') === 'shared'}" + }, + { + "source": "project.json", + "target": "%{PluginJsonFile}", + "condition": "%{JS: value('Type') === 'qtplugin'}" + }, + { + "source": "../git.ignore", + "target": ".gitignore", + "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}" + } + ] + } + ] +} diff --git a/share/qtcreator/templates/wizards/projects/nim/wizard.json b/share/qtcreator/templates/wizards/projects/nim/wizard.json index bd30370cd5..1239e444e9 100644 --- a/share/qtcreator/templates/wizards/projects/nim/wizard.json +++ b/share/qtcreator/templates/wizards/projects/nim/wizard.json @@ -8,13 +8,13 @@ "trDisplayCategory": "Non-Qt Project", "featuresRequired": [ "ToolChain.Nim.NimToolChain" ], "icon": "icon.png", - "enabled": "%{JS: [ %{Plugins} ].indexOf('Nim') >= 0 }", + "enabled": "%{JS: value('Plugins').indexOf('Nim') >= 0 }", "options": [ - { "key": "ProjectFile", "value": "%{JS: '%{NimProjectFile}'}" }, - { "key": "NimProjectFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'nimproject')}" }, - { "key": "NimFileName", "value": "%{JS: 'main.nim'}" } + { "key": "ProjectFile", "value": "%{NimProjectFile}" }, + { "key": "NimProjectFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'nimproject')}" }, + { "key": "NimFileName", "value": "main.nim" } ], "pages": @@ -28,7 +28,7 @@ "trDisplayName": "Kit Selection", "trShortTitle": "Kits", "typeId": "Kits", - "enabled": "%{JS: ! %{IsSubproject}}", + "enabled": "%{JS: !value('IsSubproject')}", "data": { "projectFilePath": "%{ProjectFile}" } }, { @@ -56,7 +56,7 @@ { "source": "../git.ignore", "target": "%{ProjectDirectory}/.gitignore", - "condition": "%{JS: ! %{IsSubproject} && '%{VersionControl}' === 'G.Git'}" + "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}" } ] } diff --git a/share/qtcreator/templates/wizards/projects/plainc/CMakeLists.txt b/share/qtcreator/templates/wizards/projects/plainc/CMakeLists.txt index f4783c4195..5af2f09fb6 100644 --- a/share/qtcreator/templates/wizards/projects/plainc/CMakeLists.txt +++ b/share/qtcreator/templates/wizards/projects/plainc/CMakeLists.txt @@ -1,4 +1,5 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.5) -project(%{ProjectName}) -add_executable(${PROJECT_NAME} "%{CFileName}") +project(%{ProjectName} LANGUAGES C) + +add_executable(%{ProjectName} %{CFileName}) diff --git a/share/qtcreator/templates/wizards/projects/plainc/wizard.json b/share/qtcreator/templates/wizards/projects/plainc/wizard.json index 56361be81d..66514cb9a7 100644 --- a/share/qtcreator/templates/wizards/projects/plainc/wizard.json +++ b/share/qtcreator/templates/wizards/projects/plainc/wizard.json @@ -7,13 +7,13 @@ "trDisplayName": "Plain C Application", "trDisplayCategory": "Non-Qt Project", "icon": "../../global/consoleapplication.png", - "enabled": "%{JS: [ %{Plugins} ].indexOf('CppEditor') >= 0 && ([ %{Plugins} ].indexOf('QmakeProjectManager') >= 0 || [ %{Plugins} ].indexOf('QbsProjectManager') >= 0 || [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0)}", + "enabled": "%{JS: value('Plugins').indexOf('CppEditor') >= 0 && (value('Plugins').indexOf('QmakeProjectManager') >= 0 || value('Plugins').indexOf('QbsProjectManager') >= 0 || value('Plugins').indexOf('CMakeProjectManager') >= 0)}", "options": [ - { "key": "ProjectFile", "value": "%{JS: '%{BuildSystem}' === 'qmake' ? '%{ProFile}' : ('%{BuildSystem}' === 'cmake' ? '%{CMakeFile}' : '%{QbsFile}')}" }, - { "key": "ProFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'pro')}" }, - { "key": "QbsFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'qbs')}" }, + { "key": "ProjectFile", "value": "%{JS: value('BuildSystem') === 'qmake' ? value('ProFile') : (value('BuildSystem') === 'cmake' ? value('CMakeFile') : value('QbsFile'))}" }, + { "key": "ProFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'pro')}" }, + { "key": "QbsFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'qbs')}" }, { "key": "CMakeFile", "value": "%{ProjectDirectory}/CMakeLists.txt" }, { "key": "CFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-csrc')}" } ], @@ -29,7 +29,7 @@ "trDisplayName": "Define Build System", "trShortTitle": "Build System", "typeId": "Fields", - "enabled": "%{JS: ! %{IsSubproject}}", + "enabled": "%{JS: !value('IsSubproject')}", "data": [ { @@ -44,17 +44,17 @@ { "trKey": "qmake", "value": "qmake", - "condition": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0}" }, { "trKey": "CMake", "value": "cmake", - "condition": "%{JS: [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('CMakeProjectManager') >= 0}" }, { "trKey": "Qbs", "value": "qbs", - "condition": "%{JS: [ %{Plugins} ].indexOf('QbsProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('QbsProjectManager') >= 0}" } ] } @@ -65,7 +65,7 @@ "trDisplayName": "Kit Selection", "trShortTitle": "Kits", "typeId": "Kits", - "enabled": "%{JS: ! %{IsSubproject}}", + "enabled": "%{JS: !value('IsSubproject')}", "data": { "projectFilePath": "%{ProjectFile}" } }, { @@ -84,18 +84,18 @@ "source": "file.pro", "target": "%{ProFile}", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'qmake'}" + "condition": "%{JS: value('BuildSystem') === 'qmake'}" }, { "source": "CMakeLists.txt", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'cmake'}" + "condition": "%{JS: value('BuildSystem') === 'cmake'}" }, { "source": "file.qbs", "target": "%{QbsFile}", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'qbs'}" + "condition": "%{JS: value('BuildSystem') === 'qbs'}" }, { "source": "main.c", @@ -105,7 +105,7 @@ { "source": "../git.ignore", "target": ".gitignore", - "condition": "%{JS: ! %{IsSubproject} && '%{VersionControl}' === 'G.Git'}" + "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}" } ] } diff --git a/share/qtcreator/templates/wizards/projects/plaincpp/CMakeLists.txt b/share/qtcreator/templates/wizards/projects/plaincpp/CMakeLists.txt index 6393118931..cdea69420e 100644 --- a/share/qtcreator/templates/wizards/projects/plaincpp/CMakeLists.txt +++ b/share/qtcreator/templates/wizards/projects/plaincpp/CMakeLists.txt @@ -1,4 +1,8 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.5) -project(%{ProjectName}) -add_executable(${PROJECT_NAME} "%{CppFileName}") +project(%{ProjectName} LANGUAGES CXX) + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +add_executable(%{ProjectName} %{CppFileName}) diff --git a/share/qtcreator/templates/wizards/projects/plaincpp/wizard.json b/share/qtcreator/templates/wizards/projects/plaincpp/wizard.json index bf48c26108..af7e84362d 100644 --- a/share/qtcreator/templates/wizards/projects/plaincpp/wizard.json +++ b/share/qtcreator/templates/wizards/projects/plaincpp/wizard.json @@ -7,7 +7,7 @@ "trDisplayName": "Plain C++ Application", "trDisplayCategory": "Non-Qt Project", "icon": "../../global/consoleapplication.png", - "enabled": "%{JS: [ %{Plugins} ].indexOf('CppEditor') >= 0 && ([ %{Plugins} ].indexOf('QmakeProjectManager') >= 0 || [ %{Plugins} ].indexOf('QbsProjectManager') >= 0 || [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0)}", + "enabled": "%{JS: value('Plugins').indexOf('CppEditor') >= 0 && (value('Plugins').indexOf('QmakeProjectManager') >= 0 || value('Plugins').indexOf('QbsProjectManager') >= 0 || value('Plugins').indexOf('CMakeProjectManager') >= 0)}", "options": [ @@ -44,17 +44,17 @@ { "trKey": "qmake", "value": "qmake", - "condition": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0}" }, { "trKey": "CMake", "value": "cmake", - "condition": "%{JS: [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}" + "condition": "%{JS: value('Plugins).indexOf('CMakeProjectManager') >= 0}" }, { "trKey": "Qbs", "value": "qbs", - "condition": "%{JS: [ %{Plugins} ].indexOf('QbsProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('QbsProjectManager') >= 0}" } ] } diff --git a/share/qtcreator/templates/wizards/projects/qmake/empty/wizard.json b/share/qtcreator/templates/wizards/projects/qmake/empty/wizard.json index 3ae9c3ff55..84f019c222 100644 --- a/share/qtcreator/templates/wizards/projects/qmake/empty/wizard.json +++ b/share/qtcreator/templates/wizards/projects/qmake/empty/wizard.json @@ -8,11 +8,11 @@ "trDisplayCategory": "Other Project", "icon": "../../../global/guiapplication.png", "featuresRequired": [ "QtSupport.Wizards.FeatureQt" ], - "enabled": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0}", "options": [ - { "key": "ProFileName", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'pro')}" }, - { "key": "IsTopLevelProject", "value": "%{JS: !'%{Exists:ProjectExplorer.Profile.Ids}'}" } + { "key": "ProFileName", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'pro')}" }, + { "key": "IsTopLevelProject", "value": "%{JS: !value('Exists:ProjectExplorer.Profile.Ids')}" } ], "pages": @@ -51,7 +51,7 @@ { "source": "../../git.ignore", "target": "%{ProjectDirectory}/.gitignore", - "condition": "%{JS: %{IsTopLevelProject} && '%{VersionControl}' === 'G.Git'}" + "condition": "%{JS: value('IsTopLevelProject') && value('VersionControl') === 'G.Git'}" } ] } diff --git a/share/qtcreator/templates/wizards/projects/qtforpythonapplication/empty/wizard.json b/share/qtcreator/templates/wizards/projects/qtforpythonapplication/empty/wizard.json index 16c2646ce5..6d734cb0e8 100644 --- a/share/qtcreator/templates/wizards/projects/qtforpythonapplication/empty/wizard.json +++ b/share/qtcreator/templates/wizards/projects/qtforpythonapplication/empty/wizard.json @@ -7,12 +7,12 @@ "trDisplayName": "Qt for Python - Empty", "trDisplayCategory": "Application", "icon": "icon.png", - "enabled": "%{JS: [ %{Plugins} ].indexOf('PythonEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('PythonEditor') >= 0}", "featuresRequired": [ "QtSupport.Wizards.FeatureQt.5.6" ], "options": [ - { "key": "MainPyFileName", "value": "main.py" }, + { "key": "SrcFileName", "value": "main.py" }, { "key": "PyProjectFile", "value": "main.pyproject" } ], @@ -42,7 +42,7 @@ }, { "source": "../main_empty.py", - "target": "%{MainPyFileName}", + "target": "%{SrcFileName}", "openInEditor": true } ] diff --git a/share/qtcreator/templates/wizards/projects/qtforpythonapplication/main.pyproject b/share/qtcreator/templates/wizards/projects/qtforpythonapplication/main.pyproject index cc7a74a346..5c790aa745 100644 --- a/share/qtcreator/templates/wizards/projects/qtforpythonapplication/main.pyproject +++ b/share/qtcreator/templates/wizards/projects/qtforpythonapplication/main.pyproject @@ -1,3 +1,3 @@ { - "files": ["main.py"] + "files": ["%{SrcFileName}"] } diff --git a/share/qtcreator/templates/wizards/projects/qtforpythonapplication/main_mainwindow.py b/share/qtcreator/templates/wizards/projects/qtforpythonapplication/main_mainwindow.py index fa1f92c747..9ec8b5d4e5 100644 --- a/share/qtcreator/templates/wizards/projects/qtforpythonapplication/main_mainwindow.py +++ b/share/qtcreator/templates/wizards/projects/qtforpythonapplication/main_mainwindow.py @@ -1,15 +1,39 @@ # This Python file uses the following encoding: utf-8 import sys +@if '%{BaseCB}' === 'QWidget' +from PySide2.QtWidgets import QApplication, QWidget +@endif +@if '%{BaseCB}' === 'QMainWindow' from PySide2.QtWidgets import QApplication, QMainWindow +@endif +@if '%{BaseCB}' === '' +from PySide2.QtWidgets import QApplication +@endif -class MainWindow(QMainWindow): +@if '%{BaseCB}' +class %{Class}(%{BaseCB}): +@else +class %{Class}: +@endif def __init__(self): +@if '%{BaseCB}' === 'QWidget' + QWidget.__init__(self) +@endif +@if '%{BaseCB}' === 'QMainWindow' QMainWindow.__init__(self) +@endif +@if '%{BaseCB}' === '' + pass # call __init__(self) of the custom base class here +@endif if __name__ == "__main__": app = QApplication([]) - window = MainWindow() + window = %{Class}() +@if '%{BaseCB}' === '' + # window.show() +@else window.show() +@endif sys.exit(app.exec_()) diff --git a/share/qtcreator/templates/wizards/projects/qtforpythonapplication/mainwindow/wizard.json b/share/qtcreator/templates/wizards/projects/qtforpythonapplication/mainwindow/wizard.json index c98ebb3ed4..c8e397d0d8 100644 --- a/share/qtcreator/templates/wizards/projects/qtforpythonapplication/mainwindow/wizard.json +++ b/share/qtcreator/templates/wizards/projects/qtforpythonapplication/mainwindow/wizard.json @@ -7,13 +7,13 @@ "trDisplayName": "Qt for Python - Window", "trDisplayCategory": "Application", "icon": "icon.png", - "enabled": "%{JS: [ %{Plugins} ].indexOf('PythonEditor') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('PythonEditor') >= 0}", "featuresRequired": [ "QtSupport.Wizards.FeatureQt.5.6" ], "options": [ - { "key": "MainPyFileName", "value": "main.py" }, - { "key": "PyProjectFile", "value": "main.pyproject" } + { "key": "MainPyFileName", "value": "%{ProjectDirectory}/%{SrcFileName}" }, + { "key": "PyProjectFile", "value": "%{ProjectDirectory}/%{ProjectFileName}" } ], "pages": @@ -21,7 +21,47 @@ { "trDisplayName": "Project Location", "trShortTitle": "Location", - "typeId": "Project" + "typeId": "Project", + "name": "ProjectPath" + }, + { + "trDisplayName": "Define Class", + "trShortTitle": "Details", + "typeId": "Fields", + "data" : + [ + { + "name": "Class", + "trDisplayName": "Class name:", + "mandatory": true, + "type": "LineEdit", + "data": { "validator": "(?:(?:[a-zA-Z_][a-zA-Z_0-9]*::)*[a-zA-Z_][a-zA-Z_0-9]*|)" } + }, + { + "name": "BaseCB", + "trDisplayName": "Base class:", + "type": "ComboBox", + "data": + { + "items": [ { "trKey": "<Custom>", "value": "" }, + "QWidget", "QMainWindow"] + } + }, + { + "name": "SrcFileName", + "type": "LineEdit", + "trDisplayName": "Source file:", + "mandatory": true, + "data": { "trText": "%{JS: Cpp.classToFileName(value('Class'), Util.preferredSuffix('text/x-python'))}" } + }, + { + "name": "ProjectFileName", + "type": "LineEdit", + "trDisplayName": "Project file:", + "mandatory": true, + "data": { "trText": "%{JS: Cpp.classToFileName(value('Class'), 'pyproject')}" } + } + ] }, { "trDisplayName": "Project Management", diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/CMakeLists.txt b/share/qtcreator/templates/wizards/projects/qtquickapplication/CMakeLists.txt index f28d772a1a..165a32be3d 100644 --- a/share/qtcreator/templates/wizards/projects/qtquickapplication/CMakeLists.txt +++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/CMakeLists.txt @@ -1,15 +1,36 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(%{ProjectName} LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) + set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(Qt5 COMPONENTS Core Quick REQUIRED) -add_executable(${PROJECT_NAME} "%{MainCppFileName}" "qml.qrc") -target_compile_definitions(${PROJECT_NAME} PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>) -target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Quick) +if(ANDROID) + add_library(%{ProjectName} SHARED %{MainCppFileName} qml.qrc) +else() + add_executable(%{ProjectName} %{MainCppFileName} qml.qrc) +endif() + +target_compile_definitions(%{ProjectName} + PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>) +target_link_libraries(%{ProjectName} + PRIVATE Qt5::Core Qt5::Quick) + +# QtCreator supports the following variables for Android, which are identical to qmake Android variables. +# Check http://doc.qt.io/qt-5/deployment-android.html for more information. +# These variables must use CACHE, otherwise QtCreator won't see them. + +#if(ANDROID) +# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android" CACHE INTERNAL "") +# if (ANDROID_ABI STREQUAL "armeabi-v7a") +# set(ANDROID_EXTRA_LIBS ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libcrypto.so ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libssl.so CACHE INTERNAL "") +# endif() +#endif() diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/app.pro b/share/qtcreator/templates/wizards/projects/qtquickapplication/app.pro index c979910fdd..0ac5682b11 100644 --- a/share/qtcreator/templates/wizards/projects/qtquickapplication/app.pro +++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/app.pro @@ -1,4 +1,9 @@ +@if "%{UseVirtualKeyboard}" == "true" +QT += quick virtualkeyboard +@else QT += quick +@endif + CONFIG += c++11 # The following define makes your compiler emit warnings if you use diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/app.qbs b/share/qtcreator/templates/wizards/projects/qtquickapplication/app.qbs index 76257178c6..d86ee9b454 100644 --- a/share/qtcreator/templates/wizards/projects/qtquickapplication/app.qbs +++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/app.qbs @@ -1,12 +1,16 @@ import qbs -CppApplication { +Application { +@if "%{UseVirtualKeyboard}" == "true" + Depends { name: "Qt"; submodules: "quick", "virtualkeyboard" } +@else Depends { name: "Qt.quick" } +@endif // Additional import path used to resolve QML modules in Qt Creator's code model property pathList qmlImportPaths: [] - cpp.cxxLanguageVersion: "c++11" + cpp.cxxLanguageVersion: "c++14" cpp.defines: [ // The following define makes your compiler emit warnings if you use diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/empty/wizard.json b/share/qtcreator/templates/wizards/projects/qtquickapplication/empty/wizard.json index d26bec5ec6..329fc6c14a 100644 --- a/share/qtcreator/templates/wizards/projects/qtquickapplication/empty/wizard.json +++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/empty/wizard.json @@ -8,20 +8,20 @@ "trDisplayCategory": "Application", "icon": "icon.png", "featuresRequired": [ "QtSupport.Wizards.FeatureQt.5.6" ], - "enabled": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0 || [ %{Plugins} ].indexOf('QbsProjectManager') >= 0 || [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0 || value('Plugins').indexOf('QbsProjectManager') >= 0 || value('Plugins').indexOf('CMakeProjectManager') >= 0}", "options": [ - { "key": "ProjectFile", "value": "%{JS: '%{BuildSystem}' === 'qmake' ? '%{ProFile}' : ('%{BuildSystem}' === 'cmake' ? '%{CMakeFile}' : '%{QbsFile}')}" }, - { "key": "ProFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'pro')}" }, - { "key": "QbsFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'qbs')}" }, + { "key": "ProjectFile", "value": "%{JS: value('BuildSystem') === 'qmake' ? value('ProFile') : (value('BuildSystem') === 'cmake' ? value('CMakeFile') : value('QbsFile'))}" }, + { "key": "ProFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'pro')}" }, + { "key": "QbsFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'qbs')}" }, { "key": "CMakeFile", "value": "%{ProjectDirectory}/CMakeLists.txt" }, { "key": "MainCppFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src')}" }, - { "key": "QtQuickVersion", "value": "%{JS: %{QtVersion}.QtQuickVersion}" }, - { "key": "QtQuickWindowVersion", "value": "%{JS: %{QtVersion}.QtQuickWindowVersion}" }, - { "key": "QtQuickVirtualKeyboardImport", "value": "%{JS: %{QtVersion}.QtQuickVirtualKeyboardImport}" }, + { "key": "QtQuickVersion", "value": "%{JS: value('QtVersion').QtQuickVersion}" }, + { "key": "QtQuickWindowVersion", "value": "%{JS: value('QtVersion').QtQuickWindowVersion}" }, + { "key": "QtQuickVirtualKeyboardImport", "value": "%{JS: value('QtVersion').QtQuickVirtualKeyboardImport}" }, { "key": "QtQuickFeature", "value": "QtSupport.Wizards.FeatureQtQuick.%{QtQuickVersion}" }, - { "key": "UseVirtualKeyboardByDefault", "value": "%{JS: [ %{Plugins} ].indexOf('Boot2Qt') >= 0 || [ %{Plugins} ].indexOf('Boot2QtQdb') >= 0}" }, + { "key": "UseVirtualKeyboardByDefault", "value": "%{JS: value('Plugins').indexOf('Boot2Qt') >= 0 || value('Plugins').indexOf('Boot2QtQdb') >= 0}" }, { "key": "SetQPAPhysicalSize", "value": "%{UseVirtualKeyboardByDefault}" } ], @@ -36,7 +36,7 @@ "trDisplayName": "Define Build System", "trShortTitle": "Build System", "typeId": "Fields", - "enabled": "%{JS: ! %{IsSubproject}}", + "enabled": "%{JS: !value('IsSubproject')}", "data": [ { @@ -51,17 +51,17 @@ { "trKey": "qmake", "value": "qmake", - "condition": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0}" }, { "trKey": "CMake", "value": "cmake", - "condition": "%{JS: [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('CMakeProjectManager') >= 0}" }, { "trKey": "Qbs", "value": "qbs", - "condition": "%{JS: [ %{Plugins} ].indexOf('QbsProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('QbsProjectManager') >= 0}" } ] } @@ -86,74 +86,74 @@ { "trKey": "Qt 5.13", "value": - "({ - 'QtQuickVersion': '2.13', - 'QtQuickWindowVersion': '2.13', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.4' - })" + { + "QtQuickVersion": "2.13", + "QtQuickWindowVersion": "2.13", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.4" + } }, { "trKey": "Qt 5.12", "value": - "({ - 'QtQuickVersion': '2.12', - 'QtQuickWindowVersion': '2.12', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.4' - })" + { + "QtQuickVersion": "2.12", + "QtQuickWindowVersion": "2.12", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.4" + } }, { "trKey": "Qt 5.11", "value": - "({ - 'QtQuickVersion': '2.11', - 'QtQuickWindowVersion': '2.11', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.3' - })" + { + "QtQuickVersion": "2.11", + "QtQuickWindowVersion": "2.11", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.3" + } }, { "trKey": "Qt 5.10", "value": - "({ - 'QtQuickVersion': '2.10', - 'QtQuickWindowVersion': '2.10', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.3' - })" + { + "QtQuickVersion": "2.10", + "QtQuickWindowVersion": "2.10", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.3" + } }, { "trKey": "Qt 5.9", "value": - "({ - 'QtQuickVersion': '2.9', - 'QtQuickWindowVersion': '2.2', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.2' - })" + { + "QtQuickVersion": "2.9", + "QtQuickWindowVersion": "2.9", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.2" + } }, { "trKey": "Qt 5.8", "value": - "({ - 'QtQuickVersion': '2.8', - 'QtQuickWindowVersion': '2.2', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.1' - })" + { + "QtQuickVersion": "2.8", + "QtQuickWindowVersion": "2.8", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.1" + } }, { "trKey": "Qt 5.7", "value": - "({ - 'QtQuickVersion': '2.7', - 'QtQuickWindowVersion': '2.2', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.1' - })" + { + "QtQuickVersion": "2.7", + "QtQuickWindowVersion": "2.7", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.1" + } }, { "trKey": "Qt 5.6", "value": - "({ - 'QtQuickVersion': '2.6', - 'QtQuickWindowVersion': '2.2', - 'QtQuickVirtualKeyboardImport': 'QtQuick.Enterprise.VirtualKeyboard 2.0' - })" + { + "QtQuickVersion": "2.6", + "QtQuickWindowVersion": "2.6", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.0" + } } ] } @@ -164,7 +164,7 @@ "type": "CheckBox", "data": { - "checked": "%{JS: %{UseVirtualKeyboardByDefault}}" + "checked": "%{UseVirtualKeyboardByDefault}" } } ] @@ -173,7 +173,7 @@ "trDisplayName": "Kit Selection", "trShortTitle": "Kits", "typeId": "Kits", - "enabled": "%{JS: ! %{IsSubproject}}", + "enabled": "%{JS: !value('IsSubproject')}", "data": { "projectFilePath": "%{ProjectFile}", "requiredFeatures": [ "QtSupport.Wizards.FeatureQt", "%{QtQuickFeature}" ] @@ -195,19 +195,19 @@ "source": "../app.pro", "target": "%{ProFile}", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'qmake'}" + "condition": "%{JS: value('BuildSystem') === 'qmake'}" }, { "source": "../CMakeLists.txt", "target": "CMakeLists.txt", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'cmake'}" + "condition": "%{JS: value('BuildSystem') === 'cmake'}" }, { "source": "../app.qbs", "target": "%{QbsFile}", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'qbs'}" + "condition": "%{JS: value('BuildSystem') === 'qbs'}" }, { "source": "../main.cpp", @@ -224,7 +224,7 @@ { "source": "../../git.ignore", "target": ".gitignore", - "condition": "%{JS: !%{IsSubproject} && '%{VersionControl}' === 'G.Git'}" + "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}" } ] } diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/scroll/wizard.json b/share/qtcreator/templates/wizards/projects/qtquickapplication/scroll/wizard.json index 098456a431..f03b62635a 100644 --- a/share/qtcreator/templates/wizards/projects/qtquickapplication/scroll/wizard.json +++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/scroll/wizard.json @@ -8,22 +8,22 @@ "trDisplayCategory": "Application", "icon": "icon.png", "featuresRequired": [ "QtSupport.Wizards.FeatureQt.5.9" ], - "enabled": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0 || [ %{Plugins} ].indexOf('QbsProjectManager') >= 0 || [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0 || value('Plugins').indexOf('QbsProjectManager') >= 0 || value('Plugins').indexOf('CMakeProjectManager') >= 0}", "options": [ - { "key": "ProjectFile", "value": "%{JS: '%{BuildSystem}' === 'qmake' ? '%{ProFile}' : ('%{BuildSystem}' === 'cmake' ? '%{CMakeFile}' : '%{QbsFile}')}" }, - { "key": "ProFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'pro')}" }, - { "key": "QbsFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'qbs')}" }, + { "key": "ProjectFile", "value": "%{JS: value('BuildSystem') === 'qmake' ? value('ProFile') : (value('BuildSystem') === 'cmake' ? value('CMakeFile') : value('QbsFile'))}" }, + { "key": "ProFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'pro')}" }, + { "key": "QbsFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'qbs')}" }, { "key": "CMakeFile", "value": "%{ProjectDirectory}/CMakeLists.txt" }, { "key": "MainCppFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src')}" }, - { "key": "QtQuickVersion", "value": "%{JS: %{QtVersion}.QtQuickVersion}" }, - { "key": "QtQuickControlsVersion", "value": "%{JS: %{QtVersion}.QtQuickControlsVersion}" }, - { "key": "QtQuickVirtualKeyboardImport", "value": "%{JS: %{QtVersion}.QtQuickVirtualKeyboardImport}" }, - { "key": "QtQuickControlsStyle", "value": "%{JS: %{ControlsStyle}.QtQuickControlsStyle}" }, - { "key": "QtQuickControlsStyleTheme", "value": "%{JS: %{ControlsStyle}.QtQuickControlsStyleTheme}" }, + { "key": "QtQuickVersion", "value": "%{JS: value('QtVersion').QtQuickVersion}" }, + { "key": "QtQuickControlsVersion", "value": "%{JS: value('QtVersion').QtQuickControlsVersion}" }, + { "key": "QtQuickVirtualKeyboardImport", "value": "%{JS: value('QtVersion').QtQuickVirtualKeyboardImport}" }, + { "key": "QtQuickControlsStyle", "value": "%{JS: value('ControlsStyle').QtQuickControlsStyle}" }, + { "key": "QtQuickControlsStyleTheme", "value": "%{JS: value('ControlsStyle').QtQuickControlsStyleTheme}" }, { "key": "QtQuickFeature", "value": "QtSupport.Wizards.FeatureQtQuick.%{QtQuickVersion}" }, - { "key": "UseVirtualKeyboardByDefault", "value": "%{JS: [ %{Plugins} ].indexOf('Boot2Qt') >= 0 || [ %{Plugins} ].indexOf('Boot2QtQdb') >= 0}" }, + { "key": "UseVirtualKeyboardByDefault", "value": "%{JS: value('Plugins').indexOf('Boot2Qt') >= 0 || value('Plugins').indexOf('Boot2QtQdb') >= 0}" }, { "key": "SetQPAPhysicalSize", "value": "%{UseVirtualKeyboardByDefault}" } ], @@ -38,7 +38,7 @@ "trDisplayName": "Define Build System", "trShortTitle": "Build System", "typeId": "Fields", - "enabled": "%{JS: ! %{IsSubproject}}", + "enabled": "%{JS: !value('IsSubproject')}", "data": [ { @@ -53,17 +53,17 @@ { "trKey": "qmake", "value": "qmake", - "condition": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0}" }, { "trKey": "CMake", "value": "cmake", - "condition": "%{JS: [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('CMakeProjectManager') >= 0}" }, { "trKey": "Qbs", "value": "qbs", - "condition": "%{JS: [ %{Plugins} ].indexOf('QbsProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('QbsProjectManager') >= 0}" } ] } @@ -88,47 +88,47 @@ { "trKey": "Qt 5.13", "value": - "({ - 'QtQuickVersion': '2.13', - 'QtQuickControlsVersion': '2.13', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.4' - })" + { + "QtQuickVersion": "2.13", + "QtQuickControlsVersion": "2.13", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.4" + } }, { "trKey": "Qt 5.12", "value": - "({ - 'QtQuickVersion': '2.12', - 'QtQuickControlsVersion': '2.5', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.4' - })" + { + "QtQuickVersion": "2.12", + "QtQuickControlsVersion": "2.5", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.4" + } }, { "trKey": "Qt 5.11", "value": - "({ - 'QtQuickVersion': '2.11', - 'QtQuickControlsVersion': '2.4', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.3' - })" + { + "QtQuickVersion": "2.11", + "QtQuickControlsVersion": "2.4", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.3" + } }, { "trKey": "Qt 5.10", "value": - "({ - 'QtQuickVersion': '2.10', - 'QtQuickControlsVersion': '2.3', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.3' - })" + { + "QtQuickVersion": "2.10", + "QtQuickControlsVersion": "2.3", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.3" + } }, { "trKey": "Qt 5.9", "value": - "({ - 'QtQuickVersion': '2.9', - 'QtQuickControlsVersion': '2.2', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.2' - })" + { + "QtQuickVersion": "2.9", + "QtQuickControlsVersion": "2.2", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.2" + } } ] } @@ -145,66 +145,66 @@ { "trKey": "Default", "value": - "({ - 'QtQuickControlsStyle': 'Default', - 'QtQuickControlsStyleTheme': '' - })" + { + "QtQuickControlsStyle": "Default", + "QtQuickControlsStyleTheme": "" + } }, { "trKey": "Material Light", "value": - "({ - 'QtQuickControlsStyle': 'Material', - 'QtQuickControlsStyleTheme': 'Light' - })" + { + "QtQuickControlsStyle": "Material", + "QtQuickControlsStyleTheme": "Light" + } }, { "trKey": "Material Dark", "value": - "({ - 'QtQuickControlsStyle': 'Material', - 'QtQuickControlsStyleTheme': 'Dark' - })" + { + "QtQuickControlsStyle": "Material", + "QtQuickControlsStyleTheme": "Dark" + } }, { "trKey": "Universal Light", "value": - "({ - 'QtQuickControlsStyle': 'Universal', - 'QtQuickControlsStyleTheme': 'Light' - })" + { + "QtQuickControlsStyle": "Universal", + "QtQuickControlsStyleTheme": "Light" + } }, { "trKey": "Universal Dark", "value": - "({ - 'QtQuickControlsStyle': 'Universal', - 'QtQuickControlsStyleTheme': 'Dark' - })" + { + "QtQuickControlsStyle": "Universal", + "QtQuickControlsStyleTheme": "Dark" + } }, { "trKey": "Universal System", "value": - "({ - 'QtQuickControlsStyle': 'Universal', - 'QtQuickControlsStyleTheme': 'System' - })" + { + "QtQuickControlsStyle": "Universal", + "QtQuickControlsStyleTheme": "System" + } }, { "trKey": "Fusion (Qt 5.10+)", "value": - "({ - 'QtQuickControlsStyle': 'Fusion', - 'QtQuickControlsStyleTheme': '' - })" + { + "QtQuickControlsStyle": "Fusion", + "QtQuickControlsStyleTheme": "" + } }, { "trKey": "Imagine (Qt 5.10+)", "value": - "({ - 'QtQuickControlsStyle': 'Imagine', - 'QtQuickControlsStyleTheme': '' - })" + { + "QtQuickControlsStyle": "Imagine", + "QtQuickControlsStyleTheme": "" + } } ] } @@ -215,7 +215,7 @@ "type": "CheckBox", "data": { - "checked": "%{JS: %{UseVirtualKeyboardByDefault}}" + "checked": "%{UseVirtualKeyboardByDefault}" } } ] @@ -224,7 +224,7 @@ "trDisplayName": "Kit Selection", "trShortTitle": "Kits", "typeId": "Kits", - "enabled": "%{JS: ! %{IsSubproject}}", + "enabled": "%{JS: !value('IsSubproject')}", "data": { "projectFilePath": "%{ProjectFile}", "requiredFeatures": [ "QtSupport.Wizards.FeatureQt", "%{QtQuickFeature}" ] @@ -246,19 +246,19 @@ "source": "../app.pro", "target": "%{ProFile}", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'qmake'}" + "condition": "%{JS: value('BuildSystem') === 'qmake'}" }, { "source": "../CMakeLists.txt", "target": "CMakeLists.txt", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'cmake'}" + "condition": "%{JS: value('BuildSystem') === 'cmake'}" }, { "source": "../app.qbs", "target": "%{QbsFile}", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'qbs'}" + "condition": "%{JS: value('BuildSystem') === 'qbs'}" }, { "source": "../main.cpp", @@ -279,7 +279,7 @@ { "source": "../../git.ignore", "target": ".gitignore", - "condition": "%{JS: !%{IsSubproject} && '%{VersionControl}' === 'G.Git'}" + "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}" } ] } diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/stack/wizard.json b/share/qtcreator/templates/wizards/projects/qtquickapplication/stack/wizard.json index 0b0f8558ac..6640901abe 100644 --- a/share/qtcreator/templates/wizards/projects/qtquickapplication/stack/wizard.json +++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/stack/wizard.json @@ -8,22 +8,22 @@ "trDisplayCategory": "Application", "icon": "icon.png", "featuresRequired": [ "QtSupport.Wizards.FeatureQt.5.7" ], - "enabled": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0 || [ %{Plugins} ].indexOf('QbsProjectManager') >= 0 || [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0 || value('Plugins').indexOf('QbsProjectManager') >= 0 || value('Plugins').indexOf('CMakeProjectManager') >= 0}", "options": [ - { "key": "ProjectFile", "value": "%{JS: '%{BuildSystem}' === 'qmake' ? '%{ProFile}' : ('%{BuildSystem}' === 'cmake' ? '%{CMakeFile}' : '%{QbsFile}')}" }, - { "key": "ProFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'pro')}" }, - { "key": "QbsFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'qbs')}" }, + { "key": "ProjectFile", "value": "%{JS: value('BuildSystem') === 'qmake' ? value('ProFile') : (value('BuildSystem') === 'cmake' ? value('CMakeFile') : value('QbsFile'))}" }, + { "key": "ProFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'pro')}" }, + { "key": "QbsFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'qbs')}" }, { "key": "CMakeFile", "value": "%{ProjectDirectory}/CMakeLists.txt" }, { "key": "MainCppFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src')}" }, - { "key": "QtQuickVersion", "value": "%{JS: %{QtVersion}.QtQuickVersion}" }, - { "key": "QtQuickControlsVersion", "value": "%{JS: %{QtVersion}.QtQuickControlsVersion}" }, - { "key": "QtQuickVirtualKeyboardImport", "value": "%{JS: %{QtVersion}.QtQuickVirtualKeyboardImport}" }, - { "key": "QtQuickControlsStyle", "value": "%{JS: %{ControlsStyle}.QtQuickControlsStyle}" }, - { "key": "QtQuickControlsStyleTheme", "value": "%{JS: %{ControlsStyle}.QtQuickControlsStyleTheme}" }, + { "key": "QtQuickVersion", "value": "%{JS: value('QtVersion').QtQuickVersion}" }, + { "key": "QtQuickControlsVersion", "value": "%{JS: value('QtVersion').QtQuickControlsVersion}" }, + { "key": "QtQuickVirtualKeyboardImport", "value": "%{JS: value('QtVersion').QtQuickVirtualKeyboardImport}" }, + { "key": "QtQuickControlsStyle", "value": "%{JS: value('ControlsStyle').QtQuickControlsStyle}" }, + { "key": "QtQuickControlsStyleTheme", "value": "%{JS: value('ControlsStyle').QtQuickControlsStyleTheme}" }, { "key": "QtQuickFeature", "value": "QtSupport.Wizards.FeatureQtQuick.%{QtQuickVersion}" }, - { "key": "UseVirtualKeyboardByDefault", "value": "%{JS: [ %{Plugins} ].indexOf('Boot2Qt') >= 0 || [ %{Plugins} ].indexOf('Boot2QtQdb') >= 0}" }, + { "key": "UseVirtualKeyboardByDefault", "value": "%{JS: value('Plugins').indexOf('Boot2Qt') >= 0 || value('Plugins').indexOf('Boot2QtQdb') >= 0}" }, { "key": "SetQPAPhysicalSize", "value": "%{UseVirtualKeyboardByDefault}" } ], @@ -38,7 +38,7 @@ "trDisplayName": "Define Build System", "trShortTitle": "Build System", "typeId": "Fields", - "enabled": "%{JS: ! %{IsSubproject}}", + "enabled": "%{JS: !value('IsSubproject')}", "data": [ { @@ -53,17 +53,17 @@ { "trKey": "qmake", "value": "qmake", - "condition": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0}" }, { "trKey": "CMake", "value": "cmake", - "condition": "%{JS: [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('CMakeProjectManager') >= 0}" }, { "trKey": "Qbs", "value": "qbs", - "condition": "%{JS: [ %{Plugins} ].indexOf('QbsProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('QbsProjectManager') >= 0}" } ] } @@ -88,65 +88,65 @@ { "trKey": "Qt 5.13", "value": - "({ - 'QtQuickVersion': '2.13', - 'QtQuickControlsVersion': '2.13', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.4' - })" + { + "QtQuickVersion": "2.13", + "QtQuickControlsVersion": "2.13", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.4" + } }, { "trKey": "Qt 5.12", "value": - "({ - 'QtQuickVersion': '2.12', - 'QtQuickControlsVersion': '2.5', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.4' - })" + { + "QtQuickVersion": "2.12", + "QtQuickControlsVersion": "2.5", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.4" + } }, { "trKey": "Qt 5.11", "value": - "({ - 'QtQuickVersion': '2.11', - 'QtQuickControlsVersion': '2.4', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.3' - })" + { + "QtQuickVersion": "2.11", + "QtQuickControlsVersion": "2.4", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.3" + } }, { "trKey": "Qt 5.10", "value": - "({ - 'QtQuickVersion': '2.10', - 'QtQuickControlsVersion': '2.3', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.3' - })" + { + "QtQuickVersion": "2.10", + "QtQuickControlsVersion": "2.3", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.3" + } }, { "trKey": "Qt 5.9", "value": - "({ - 'QtQuickVersion': '2.9', - 'QtQuickControlsVersion': '2.2', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.2' - })" + { + "QtQuickVersion": "2.9", + "QtQuickControlsVersion": "2.2", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.2" + } }, { "trKey": "Qt 5.8", "value": - "({ - 'QtQuickVersion': '2.8', - 'QtQuickControlsVersion': '2.1', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.1' - })" + { + "QtQuickVersion": "2.8", + "QtQuickControlsVersion": "2.1", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.1" + } }, { "trKey": "Qt 5.7", "value": - "({ - 'QtQuickVersion': '2.7', - 'QtQuickControlsVersion': '2.0', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.1' - })" + { + "QtQuickVersion": "2.7", + "QtQuickControlsVersion": "2.0", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.1" + } } ] } @@ -163,66 +163,66 @@ { "trKey": "Default", "value": - "({ - 'QtQuickControlsStyle': 'Default', - 'QtQuickControlsStyleTheme': '' - })" + { + "QtQuickControlsStyle": "Default", + "QtQuickControlsStyleTheme": "" + } }, { "trKey": "Material Light", "value": - "({ - 'QtQuickControlsStyle': 'Material', - 'QtQuickControlsStyleTheme': 'Light' - })" + { + "QtQuickControlsStyle": "Material", + "QtQuickControlsStyleTheme": "Light" + } }, { "trKey": "Material Dark", "value": - "({ - 'QtQuickControlsStyle': 'Material', - 'QtQuickControlsStyleTheme': 'Dark' - })" + { + "QtQuickControlsStyle": "Material", + "QtQuickControlsStyleTheme": "Dark" + } }, { "trKey": "Universal Light", "value": - "({ - 'QtQuickControlsStyle': 'Universal', - 'QtQuickControlsStyleTheme': 'Light' - })" + { + "QtQuickControlsStyle": "Universal", + "QtQuickControlsStyleTheme": "Light" + } }, { "trKey": "Universal Dark", "value": - "({ - 'QtQuickControlsStyle': 'Universal', - 'QtQuickControlsStyleTheme': 'Dark' - })" + { + "QtQuickControlsStyle": "Universal", + "QtQuickControlsStyleTheme": "Dark" + } }, { "trKey": "Universal System", "value": - "({ - 'QtQuickControlsStyle': 'Universal', - 'QtQuickControlsStyleTheme': 'System' - })" + { + "QtQuickControlsStyle": "Universal", + "QtQuickControlsStyleTheme": "System" + } }, { "trKey": "Fusion (Qt 5.10+)", "value": - "({ - 'QtQuickControlsStyle': 'Fusion', - 'QtQuickControlsStyleTheme': '' - })" + { + "QtQuickControlsStyle": "Fusion", + "QtQuickControlsStyleTheme": "" + } }, { "trKey": "Imagine (Qt 5.10+)", "value": - "({ - 'QtQuickControlsStyle': 'Imagine', - 'QtQuickControlsStyleTheme': '' - })" + { + "QtQuickControlsStyle": "Imagine", + "QtQuickControlsStyleTheme": "" + } } ] } @@ -233,7 +233,7 @@ "type": "CheckBox", "data": { - "checked": "%{JS: %{UseVirtualKeyboardByDefault}}" + "checked": "%{UseVirtualKeyboardByDefault}" } } ] @@ -242,7 +242,7 @@ "trDisplayName": "Kit Selection", "trShortTitle": "Kits", "typeId": "Kits", - "enabled": "%{JS: ! %{IsSubproject}}", + "enabled": "%{JS: !value('IsSubproject')}", "data": { "projectFilePath": "%{ProjectFile}", "requiredFeatures": [ "QtSupport.Wizards.FeatureQt", "%{QtQuickFeature}" ] @@ -264,19 +264,19 @@ "source": "../app.pro", "target": "%{ProFile}", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'qmake'}" + "condition": "%{JS: value('BuildSystem') === 'qmake'}" }, { "source": "../CMakeLists.txt", "target": "CMakeLists.txt", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'cmake'}" + "condition": "%{JS: value('BuildSystem') === 'cmake'}" }, { "source": "../app.qbs", "target": "%{QbsFile}", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'qbs'}" + "condition": "%{JS: value('BuildSystem') === 'qbs'}" }, { "source": "../main.cpp", @@ -309,7 +309,7 @@ { "source": "../../git.ignore", "target": ".gitignore", - "condition": "%{JS: !%{IsSubproject} && '%{VersionControl}' === 'G.Git'}" + "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}" } ] } diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/swipe/wizard.json b/share/qtcreator/templates/wizards/projects/qtquickapplication/swipe/wizard.json index a89e6cce26..2b6ac53030 100644 --- a/share/qtcreator/templates/wizards/projects/qtquickapplication/swipe/wizard.json +++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/swipe/wizard.json @@ -8,22 +8,22 @@ "trDisplayCategory": "Application", "icon": "icon.png", "featuresRequired": [ "QtSupport.Wizards.FeatureQt.5.7" ], - "enabled": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0 || [ %{Plugins} ].indexOf('QbsProjectManager') >= 0 || [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0 || value('Plugins').indexOf('QbsProjectManager') >= 0 || value('Plugins').indexOf('CMakeProjectManager') >= 0}", "options": [ - { "key": "ProjectFile", "value": "%{JS: '%{BuildSystem}' === 'qmake' ? '%{ProFile}' : ('%{BuildSystem}' === 'cmake' ? '%{CMakeFile}' : '%{QbsFile}')}" }, - { "key": "ProFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'pro')}" }, - { "key": "QbsFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'qbs')}" }, + { "key": "ProjectFile", "value": "%{JS: value('BuildSystem') === 'qmake' ? value('ProFile') : (value('BuildSystem') === 'cmake' ? value('CMakeFile') : value('QbsFile'))}" }, + { "key": "ProFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'pro')}" }, + { "key": "QbsFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'qbs')}" }, { "key": "CMakeFile", "value": "%{ProjectDirectory}/CMakeLists.txt" }, { "key": "MainCppFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src')}" }, - { "key": "QtQuickVersion", "value": "%{JS: %{QtVersion}.QtQuickVersion}" }, - { "key": "QtQuickControlsVersion", "value": "%{JS: %{QtVersion}.QtQuickControlsVersion}" }, - { "key": "QtQuickVirtualKeyboardImport", "value": "%{JS: %{QtVersion}.QtQuickVirtualKeyboardImport}" }, - { "key": "QtQuickControlsStyle", "value": "%{JS: %{ControlsStyle}.QtQuickControlsStyle}" }, - { "key": "QtQuickControlsStyleTheme", "value": "%{JS: %{ControlsStyle}.QtQuickControlsStyleTheme}" }, + { "key": "QtQuickVersion", "value": "%{JS: value('QtVersion').QtQuickVersion}" }, + { "key": "QtQuickControlsVersion", "value": "%{JS: value('QtVersion').QtQuickControlsVersion}" }, + { "key": "QtQuickVirtualKeyboardImport", "value": "%{JS: value('QtVersion').QtQuickVirtualKeyboardImport}" }, + { "key": "QtQuickControlsStyle", "value": "%{JS: value('ControlsStyle').QtQuickControlsStyle}" }, + { "key": "QtQuickControlsStyleTheme", "value": "%{JS: value('ControlsStyle').QtQuickControlsStyleTheme}" }, { "key": "QtQuickFeature", "value": "QtSupport.Wizards.FeatureQtQuick.%{QtQuickVersion}" }, - { "key": "UseVirtualKeyboardByDefault", "value": "%{JS: [ %{Plugins} ].indexOf('Boot2Qt') >= 0 || [ %{Plugins} ].indexOf('Boot2QtQdb') >= 0}" }, + { "key": "UseVirtualKeyboardByDefault", "value": "%{JS: value('Plugins').indexOf('Boot2Qt') >= 0 || value('Plugins').indexOf('Boot2QtQdb') >= 0}" }, { "key": "SetQPAPhysicalSize", "value": "%{UseVirtualKeyboardByDefault}" } ], @@ -38,7 +38,7 @@ "trDisplayName": "Define Build System", "trShortTitle": "Build System", "typeId": "Fields", - "enabled": "%{JS: ! %{IsSubproject}}", + "enabled": "%{JS: !value('IsSubproject')}", "data": [ { @@ -53,17 +53,17 @@ { "trKey": "qmake", "value": "qmake", - "condition": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0}" }, { "trKey": "CMake", "value": "cmake", - "condition": "%{JS: [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('CMakeProjectManager') >= 0}" }, { "trKey": "Qbs", "value": "qbs", - "condition": "%{JS: [ %{Plugins} ].indexOf('QbsProjectManager') >= 0}" + "condition": "%{JS: value('Plugins').indexOf('QbsProjectManager') >= 0}" } ] } @@ -88,65 +88,65 @@ { "trKey": "Qt 5.13", "value": - "({ - 'QtQuickVersion': '2.13', - 'QtQuickControlsVersion': '2.13', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.4' - })" + { + "QtQuickVersion": "2.13", + "QtQuickControlsVersion": "2.13", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.4" + } }, { "trKey": "Qt 5.12", "value": - "({ - 'QtQuickVersion': '2.12', - 'QtQuickControlsVersion': '2.5', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.4' - })" + { + "QtQuickVersion": "2.12", + "QtQuickControlsVersion": "2.5", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.4" + } }, { "trKey": "Qt 5.11", "value": - "({ - 'QtQuickVersion': '2.11', - 'QtQuickControlsVersion': '2.4', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.3' - })" + { + "QtQuickVersion": "2.11", + "QtQuickControlsVersion": "2.4", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.3" + } }, { "trKey": "Qt 5.10", "value": - "({ - 'QtQuickVersion': '2.10', - 'QtQuickControlsVersion': '2.3', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.3' - })" + { + "QtQuickVersion": "2.10", + "QtQuickControlsVersion": "2.3", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.3" + } }, { "trKey": "Qt 5.9", "value": - "({ - 'QtQuickVersion': '2.9', - 'QtQuickControlsVersion': '2.2', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.2' - })" + { + "QtQuickVersion": "2.9", + "QtQuickControlsVersion": "2.2", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.2" + } }, { "trKey": "Qt 5.8", "value": - "({ - 'QtQuickVersion': '2.8', - 'QtQuickControlsVersion': '2.1', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.1' - })" + { + "QtQuickVersion": "2.8", + "QtQuickControlsVersion": "2.1", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.1" + } }, { "trKey": "Qt 5.7", "value": - "({ - 'QtQuickVersion': '2.7', - 'QtQuickControlsVersion': '2.0', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.1' - })" + { + "QtQuickVersion": "2.7", + "QtQuickControlsVersion": "2.0", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.1" + } } ] } @@ -163,66 +163,66 @@ { "trKey": "Default", "value": - "({ - 'QtQuickControlsStyle': 'Default', - 'QtQuickControlsStyleTheme': '' - })" + { + "QtQuickControlsStyle": "Default", + "QtQuickControlsStyleTheme": "" + } }, { "trKey": "Material Light", "value": - "({ - 'QtQuickControlsStyle': 'Material', - 'QtQuickControlsStyleTheme': 'Light' - })" + { + "QtQuickControlsStyle": "Material", + "QtQuickControlsStyleTheme": "Light" + } }, { "trKey": "Material Dark", "value": - "({ - 'QtQuickControlsStyle': 'Material', - 'QtQuickControlsStyleTheme': 'Dark' - })" + { + "QtQuickControlsStyle": "Material", + "QtQuickControlsStyleTheme": "Dark" + } }, { "trKey": "Universal Light", "value": - "({ - 'QtQuickControlsStyle': 'Universal', - 'QtQuickControlsStyleTheme': 'Light' - })" + { + "QtQuickControlsStyle": "Universal", + "QtQuickControlsStyleTheme": "Light" + } }, { "trKey": "Universal Dark", "value": - "({ - 'QtQuickControlsStyle': 'Universal', - 'QtQuickControlsStyleTheme': 'Dark' - })" + { + "QtQuickControlsStyle": "Universal", + "QtQuickControlsStyleTheme": "Dark" + } }, { "trKey": "Universal System", "value": - "({ - 'QtQuickControlsStyle': 'Universal', - 'QtQuickControlsStyleTheme': 'System' - })" + { + "QtQuickControlsStyle": "Universal", + "QtQuickControlsStyleTheme": "System" + } }, { "trKey": "Fusion (Qt 5.10+)", "value": - "({ - 'QtQuickControlsStyle': 'Fusion', - 'QtQuickControlsStyleTheme': '' - })" + { + "QtQuickControlsStyle": "Fusion", + "QtQuickControlsStyleTheme": "" + } }, { "trKey": "Imagine (Qt 5.10+)", "value": - "({ - 'QtQuickControlsStyle': 'Imagine', - 'QtQuickControlsStyleTheme': '' - })" + { + "QtQuickControlsStyle": "Imagine", + "QtQuickControlsStyleTheme": "" + } } ] } @@ -233,7 +233,7 @@ "type": "CheckBox", "data": { - "checked": "%{JS: %{UseVirtualKeyboardByDefault}}" + "checked": "%{UseVirtualKeyboardByDefault}" } } ] @@ -242,7 +242,7 @@ "trDisplayName": "Kit Selection", "trShortTitle": "Kits", "typeId": "Kits", - "enabled": "%{JS: ! %{IsSubproject}}", + "enabled": "%{JS: !value('IsSubproject')}", "data": { "projectFilePath": "%{ProjectFile}", "requiredFeatures": [ "QtSupport.Wizards.FeatureQt", "%{QtQuickFeature}" ] @@ -264,19 +264,19 @@ "source": "../app.pro", "target": "%{ProFile}", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'qmake'}" + "condition": "%{JS: value('BuildSystem') === 'qmake'}" }, { "source": "../CMakeLists.txt", "target": "CMakeLists.txt", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'cmake'}" + "condition": "%{JS: value('BuildSystem') === 'cmake'}" }, { "source": "../app.qbs", "target": "%{QbsFile}", "openAsProject": true, - "condition": "%{JS: '%{BuildSystem}' === 'qbs'}" + "condition": "%{JS: value('BuildSystem') === 'qbs'}" }, { "source": "../main.cpp", @@ -305,7 +305,7 @@ { "source": "../../git.ignore", "target": ".gitignore", - "condition": "%{JS: !%{IsSubproject} && '%{VersionControl}' === 'G.Git'}" + "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}" } ] } diff --git a/share/qtcreator/templates/wizards/projects/qtquickuiprototype/wizard.json b/share/qtcreator/templates/wizards/projects/qtquickuiprototype/wizard.json index 8a726cc09c..79900ca557 100644 --- a/share/qtcreator/templates/wizards/projects/qtquickuiprototype/wizard.json +++ b/share/qtcreator/templates/wizards/projects/qtquickuiprototype/wizard.json @@ -7,18 +7,18 @@ "trDisplayName": "Qt Quick UI Prototype", "trDisplayCategory": "Other Project", "icon": "qtquickuiprototype.png", - "enabled": "%{JS: [ %{Plugins} ].indexOf('QmlProjectManager') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('QmlProjectManager') >= 0}", "featuresRequired": [ "QtSupport.Wizards.FeatureQtQuickProject", "QtSupport.Wizards.FeatureQt" ], "options": [ - { "key": "QmlProjectFileName", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'qmlproject')}" }, - { "key": "MainQmlFileName", "value": "%{JS: Util.fileName('%{ProjectName}', 'qml')}" }, - { "key": "QtQuickVersion", "value": "%{JS: %{QtVersion}.QtQuickVersion}" }, - { "key": "QtQuickWindowVersion", "value": "%{JS: %{QtVersion}.QtQuickWindowVersion}" }, - { "key": "QtQuickVirtualKeyboardImport", "value": "%{JS: %{QtVersion}.QtQuickVirtualKeyboardImport}" }, + { "key": "QmlProjectFileName", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'qmlproject')}" }, + { "key": "MainQmlFileName", "value": "%{JS: Util.fileName(value('ProjectName'), 'qml')}" }, + { "key": "QtQuickVersion", "value": "%{JS: value('QtVersion').QtQuickVersion}" }, + { "key": "QtQuickWindowVersion", "value": "%{JS: value('QtVersion').QtQuickWindowVersion}" }, + { "key": "QtQuickVirtualKeyboardImport", "value": "%{JS: value('QtVersion').QtQuickVirtualKeyboardImport}" }, { "key": "QtQuickFeature", "value": "QtSupport.Wizards.FeatureQtQuick.%{QtQuickVersion}" }, - { "key": "UseVirtualKeyboardByDefault", "value": "%{JS: [ %{Plugins} ].indexOf('Boot2Qt') >= 0 || [ %{Plugins} ].indexOf('Boot2QtQdb') >= 0}" } + { "key": "UseVirtualKeyboardByDefault", "value": "%{JS: value('Plugins').indexOf('Boot2Qt') >= 0 || value('Plugins').indexOf('Boot2QtQdb') >= 0}" } ], "pages": @@ -46,74 +46,74 @@ { "trKey": "Qt 5.13", "value": - "({ - 'QtQuickVersion': '2.13', - 'QtQuickWindowVersion': '2.13', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.4' - })" + { + "QtQuickVersion": "2.13", + "QtQuickWindowVersion": "2.13", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.4" + } }, { "trKey": "Qt 5.12", "value": - "({ - 'QtQuickVersion': '2.12', - 'QtQuickWindowVersion': '2.12', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.4' - })" + { + "QtQuickVersion": "2.12", + "QtQuickWindowVersion": "2.12", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.4" + } }, { "trKey": "Qt 5.11", "value": - "({ - 'QtQuickVersion': '2.11', - 'QtQuickWindowVersion': '2.11', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.3' - })" + { + "QtQuickVersion": "2.11", + "QtQuickWindowVersion": "2.11", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.3" + } }, { "trKey": "Qt 5.10", "value": - "({ - 'QtQuickVersion': '2.10', - 'QtQuickWindowVersion': '2.10', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.3' - })" + { + "QtQuickVersion": "2.10", + "QtQuickWindowVersion": "2.10", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.3" + } }, { "trKey": "Qt 5.9", "value": - "({ - 'QtQuickVersion': '2.9', - 'QtQuickWindowVersion': '2.3', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.2' - })" + { + "QtQuickVersion": "2.9", + "QtQuickWindowVersion": "2.9", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.2" + } }, { "trKey": "Qt 5.8", "value": - "({ - 'QtQuickVersion': '2.8', - 'QtQuickWindowVersion': '2.2', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.1' - })" + { + "QtQuickVersion": "2.8", + "QtQuickWindowVersion": "2.8", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.1" + } }, { "trKey": "Qt 5.7", "value": - "({ - 'QtQuickVersion': '2.7', - 'QtQuickWindowVersion': '2.2', - 'QtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.1' - })" + { + "QtQuickVersion": "2.7", + "QtQuickWindowVersion": "2.7", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.1" + } }, { "trKey": "Qt 5.6", "value": - "({ - 'QtQuickVersion': '2.6', - 'QtQuickWindowVersion': '2.2', - 'QtQuickVirtualKeyboardImport': 'QtQuick.Enterprise.VirtualKeyboard 2.0' - })" + { + "QtQuickVersion": "2.6", + "QtQuickWindowVersion": "2.6", + "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.0" + } } ] } @@ -124,7 +124,7 @@ "type": "CheckBox", "data": { - "checked": "%{JS: %{UseVirtualKeyboardByDefault}}" + "checked": "%{UseVirtualKeyboardByDefault}" } } ] @@ -164,7 +164,7 @@ { "source": "../git.ignore", "target": "%{ProjectDirectory}/.gitignore", - "condition": "%{JS: !%{IsSubproject} && '%{VersionControl}' === 'G.Git'}" + "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}" } ] } diff --git a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/CMakeLists.txt b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/CMakeLists.txt new file mode 100644 index 0000000000..5fd51e9014 --- /dev/null +++ b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/CMakeLists.txt @@ -0,0 +1,25 @@ +cmake_minimum_required(VERSION 3.5) + +project(%{ProjectName} LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +find_package(Qt5 COMPONENTS Widgets REQUIRED) + +add_executable(%{ProjectName} + %{MainFileName} + %{SrcFileName} + %{HdrFileName} +@if %{GenerateForm} + %{FormFileName} +@endif +) + +target_link_libraries(%{ProjectName} PRIVATE Qt5::Widgets) diff --git a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/main.cpp b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/main.cpp new file mode 100644 index 0000000000..5c64f1d05e --- /dev/null +++ b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/main.cpp @@ -0,0 +1,12 @@ +%{Cpp:LicenseTemplate}\ +#include "%{HdrFileName}" + +%{JS: QtSupport.qtIncludes([ 'QtGui/QApplication' ], [ 'QtWidgets/QApplication' ]) }\ + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + %{Class} w; + w.show(); + return a.exec(); +} diff --git a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/project.pro b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/project.pro new file mode 100644 index 0000000000..a5362aa9bc --- /dev/null +++ b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/project.pro @@ -0,0 +1,33 @@ +QT += core gui + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +CONFIG += c++11 + +# 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. +DEFINES += QT_DEPRECATED_WARNINGS + +# You can also make your code fail to compile if it uses deprecated APIs. +# In order to do so, uncomment the following line. +# You can also select to disable deprecated APIs only up to a certain version of Qt. +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + +SOURCES += \\ + %{MainFileName} \\ + %{SrcFileName} + +HEADERS += \\ + %{HdrFileName} +@if %{GenerateForm} + +FORMS += \\ + %{FormFileName} +@endif + +# Default rules for deployment. +qnx: target.path = /tmp/$${TARGET}/bin +else: unix:!android: target.path = /opt/$${TARGET}/bin +!isEmpty(target.path): INSTALLS += target 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 0000000000..4a54380d6b --- /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/widget.cpp b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/widget.cpp new file mode 100644 index 0000000000..356e2444f6 --- /dev/null +++ b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/widget.cpp @@ -0,0 +1,26 @@ +%{Cpp:LicenseTemplate}\ +#include "%{JS: Util.relativeFilePath('%{Path}/%{HdrFileName}', '%{Path}' + '/' + Util.path('%{SrcFileName}'))}" +@if %{GenerateForm} +#include "%{UiHdrFileName}" +@endif +%{JS: Cpp.openNamespaces('%{Class}')}\ + +%{CN}::%{CN}(QWidget *parent) + : %{BaseClass}(parent) +@if %{GenerateForm} + , ui(new Ui::%{CN}) +@endif +{ +@if %{GenerateForm} + ui->setupUi(this); +@endif +} + +%{CN}::~%{CN}() +{ +@if %{GenerateForm} + delete ui; +@endif +} + +%{JS: Cpp.closeNamespaces('%{Class}')}\ diff --git a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/widget.h b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/widget.h new file mode 100644 index 0000000000..dca6171267 --- /dev/null +++ b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/widget.h @@ -0,0 +1,38 @@ +%{Cpp:LicenseTemplate}\ +@if '%{Cpp:PragmaOnce}' +#pragma once +@else +#ifndef %{GUARD} +#define %{GUARD} +@endif + +%{JS: QtSupport.qtIncludes([ 'QtGui/%{BaseClass}' ], [ 'QtWidgets/%{BaseClass}' ]) }\ +%{JS: Cpp.openNamespaces('%{Class}')}\ +@if %{GenerateForm} + +@if ! %{JS: Cpp.hasNamespaces('%{Class}')} +QT_BEGIN_NAMESPACE +@endif +namespace Ui { class %{CN}; } +@if ! %{JS: Cpp.hasNamespaces('%{Class}')} +QT_END_NAMESPACE +@endif +@endif + +class %{CN} : public %{BaseClass} +{ + Q_OBJECT + +public: + %{CN}(QWidget *parent = nullptr); + ~%{CN}(); +@if %{GenerateForm} + +private: + Ui::%{CN} *ui; +@endif +}; +%{JS: Cpp.closeNamespaces('%{Class}')}\ +@if ! '%{Cpp:PragmaOnce}' +#endif // %{GUARD} +@endif diff --git a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/widget.ui b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/widget.ui new file mode 100644 index 0000000000..1b21b83109 --- /dev/null +++ b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/widget.ui @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>%{Class}</class> + <widget class="%{BaseClass}" name="%{Class}"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>800</width> + <height>600</height> + </rect> + </property> + <property name="windowTitle"> + <string>%{CN}</string> + </property> +@if '%{BaseClass}' === 'QMainWindow' + <widget class="QWidget" name="centralwidget"/> + <widget class="QMenuBar" name="menubar"/> + <widget class="QStatusBar" name="statusbar"/> +@endif + </widget> + <resources/> + <connections/> +</ui> diff --git a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/wizard.json b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/wizard.json new file mode 100644 index 0000000000..9cce84a413 --- /dev/null +++ b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/wizard.json @@ -0,0 +1,204 @@ +{ + "version": 1, + "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.", + "trDisplayName": "Qt Widgets Application", + "trDisplayCategory": "Application", + "icon": "../../global/guiapplication.png", + "featuresRequired": [ "QtSupport.Wizards.FeatureQt" ], + "enabled": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0 || value('Plugins').indexOf('CMakeProjectManager') >= 0 || value('Plugins').indexOf('QbsProjectManager') >= 0}", + + "options": + [ + { "key": "ProjectFile", "value": "%{JS: value('BuildSystem') === 'qmake' ? value('ProFile') : value('BuildSystem') === 'cmake' ? value('CMakeFile') : value('QbsFile')}" }, + { "key": "ProFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'pro')}" }, + { "key": "CMakeFile", "value": "%{ProjectDirectory}/CMakeLists.txt" }, + { "key": "QbsFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'qbs')}" }, + { "key": "MainFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src')}" }, + { "key": "UiHdrFileName", "value": "%{JS: (value('BuildSystem') === 'cmake' ? (Util.path(value('FormFileName')) + '/') : '') + 'ui_' + Util.completeBaseName(value('FormFileName')) + '.h'}" }, + { "key": "CN", "value": "%{JS: Cpp.className(value('Class'))}" }, + { "key": "GUARD", "value": "%{JS: Cpp.classToHeaderGuard(value('Class'), Util.suffix(value('HdrFileName')))}" } + ], + + "pages": + [ + { + "trDisplayName": "Project Location", + "trShortTitle": "Location", + "typeId": "Project", + "data": { "trDescription": "This wizard generates a Qt Widgets Application project. The application derives by default from QApplication and includes an empty widget." } + }, + { + "trDisplayName": "Define Build System", + "trShortTitle": "Build System", + "typeId": "Fields", + "enabled": "%{JS: !value('IsSubproject')}", + "data": + [ + { + "name": "BuildSystem", + "trDisplayName": "Build system:", + "type": "ComboBox", + "data": + { + "index": 0, + "items": + [ + { + "trKey": "qmake", + "value": "qmake", + "condition": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0}" + }, + { + "trKey": "CMake", + "value": "cmake", + "condition": "%{JS: value('Plugins').indexOf('CMakeProjectManager') >= 0}" + }, + { + "trKey": "Qbs", + "value": "qbs", + "condition": "%{JS: value('Plugins').indexOf('QbsProjectManager') >= 0}" + } + ] + } + } + ] + }, + { + "trDisplayName": "Class Information", + "trShortTitle": "Details", + "typeId": "Fields", + "data": + [ + { + "name": "ClassPageDescription", + "type": "Label", + "data": + { + "trText": "Specify basic information about the classes for which you want to generate skeleton source code files.", + "wordWrap": true + } + }, + { + "name": "Sp0", + "type": "Spacer" + }, + { + "name": "Class", + "trDisplayName": "Class name:", + "mandatory": true, + "type": "LineEdit", + "data": + { + "validator": "(?:(?:[a-zA-Z_][a-zA-Z_0-9]*::)*[a-zA-Z_][a-zA-Z_0-9]*|)", + "trText": "%{JS: value('BaseClass') ? value('BaseClass').slice(1) : 'MyClass'}" + } + }, + { + "name": "BaseClass", + "trDisplayName": "Base class:", + "type": "ComboBox", + "data": + { + "items": [ "QMainWindow", "QWidget", "QDialog" ] + } + }, + { + "name": "Sp1", + "type": "Spacer" + }, + { + "name": "HdrFileName", + "type": "LineEdit", + "trDisplayName": "Header file:", + "mandatory": true, + "data": { "trText": "%{JS: Cpp.classToFileName(value('Class'), Util.preferredSuffix('text/x-c++hdr'))}" } + }, + { + "name": "SrcFileName", + "type": "LineEdit", + "trDisplayName": "Source file:", + "mandatory": true, + "data": { "trText": "%{JS: Cpp.classToFileName(value('Class'), Util.preferredSuffix('text/x-c++src'))}" } + }, + { + "name": "GenerateForm", + "type": "CheckBox", + "trDisplayName": "Generate form", + "data": { "checked": true } + }, + { + "name": "FormFileName", + "type": "LineEdit", + "trDisplayName": "Form file:", + "enabled": "%{GenerateForm}", + "mandatory": true, + "data": { "trText": "%{JS: Cpp.classToFileName(value('Class'), 'ui')}" } + } + ] + }, + { + "trDisplayName": "Kit Selection", + "trShortTitle": "Kits", + "typeId": "Kits", + "enabled": "%{JS: !value('IsSubproject')}", + "data": { "projectFilePath": "%{ProjectFile}" } + }, + { + "trDisplayName": "Project Management", + "trShortTitle": "Summary", + "typeId": "Summary" + } + ], + "generators": + [ + { + "typeId": "File", + "data": + [ + { + "source": "project.pro", + "target": "%{ProFile}", + "openAsProject": true, + "condition": "%{JS: value('BuildSystem') === 'qmake'}" + }, + { + "source": "CMakeLists.txt", + "openAsProject": true, + "condition": "%{JS: value('BuildSystem') === 'cmake'}" + }, + { + "source": "project.qbs", + "target": "%{QbsFile}", + "openAsProject": true, + "condition": "%{JS: value('BuildSystem') === 'qbs'}" + }, + { + "source": "main.cpp", + "target": "%{MainFileName}", + "openInEditor": true + }, + { + "source": "widget.cpp", + "target": "%{SrcFileName}" + }, + { + "source": "widget.h", + "target": "%{HdrFileName}" + }, + { + "source": "widget.ui", + "target": "%{FormFileName}", + "condition": "%{GenerateForm}" + }, + { + "source": "../git.ignore", + "target": ".gitignore", + "condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}" + } + ] + } + ] +} diff --git a/share/qtcreator/templates/wizards/projects/vcs/bazaar/wizard.json b/share/qtcreator/templates/wizards/projects/vcs/bazaar/wizard.json index 9e4d494f45..a8b4d041e7 100644 --- a/share/qtcreator/templates/wizards/projects/vcs/bazaar/wizard.json +++ b/share/qtcreator/templates/wizards/projects/vcs/bazaar/wizard.json @@ -7,7 +7,7 @@ "trDisplayName": "Bazaar Clone (Or Branch)", "trDisplayCategory": "Import Project", "icon": "icon.png", - "enabled": "%{JS: [ %{Plugins} ].indexOf('Bazaar') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('Bazaar') >= 0}", "options": [ diff --git a/share/qtcreator/templates/wizards/projects/vcs/cvs/wizard.json b/share/qtcreator/templates/wizards/projects/vcs/cvs/wizard.json index 15dc344567..10969e3da8 100644 --- a/share/qtcreator/templates/wizards/projects/vcs/cvs/wizard.json +++ b/share/qtcreator/templates/wizards/projects/vcs/cvs/wizard.json @@ -7,7 +7,7 @@ "trDisplayName": "CVS Checkout", "trDisplayCategory": "Import Project", "icon": "icon.png", - "enabled": "%{JS: [ %{Plugins} ].indexOf('CVS') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('CVS') >= 0}", "options": [ diff --git a/share/qtcreator/templates/wizards/projects/vcs/git/wizard.json b/share/qtcreator/templates/wizards/projects/vcs/git/wizard.json index be1cd42904..c97698612b 100644 --- a/share/qtcreator/templates/wizards/projects/vcs/git/wizard.json +++ b/share/qtcreator/templates/wizards/projects/vcs/git/wizard.json @@ -7,13 +7,13 @@ "trDisplayName": "Git Clone", "trDisplayCategory": "Import Project", "icon": "icon.png", - "enabled": "%{JS: [ %{Plugins} ].indexOf('Git') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('Git') >= 0}", "options": [ { "key": "vcsId", "value": "G.Git" }, { "key": "vcsName", "value": "%{JS: Vcs.displayName('%{vcsId}')}" }, - { "key": "SR", "value": "%{JS: '%{Repo}'.replace(/\.git$/, '') }"}, + { "key": "SR", "value": "%{JS: '%{Repo}'.replace(/\\.git$/, '') }"}, { "key": "defaultDir", "value": "%{JS: '%{SR}'.substr('%{SR}'.lastIndexOf('/') + 1).replace(/\\./, '-') }"}, { "key": "branchArg", "value": "%{JS: '%{Branch}' ? '--branch' : '' }" }, { "key": "TargetPath", "value": "%{Path}/%{Dir}" } diff --git a/share/qtcreator/templates/wizards/projects/vcs/mercurial/wizard.json b/share/qtcreator/templates/wizards/projects/vcs/mercurial/wizard.json index 9fe95ba049..75bd410861 100644 --- a/share/qtcreator/templates/wizards/projects/vcs/mercurial/wizard.json +++ b/share/qtcreator/templates/wizards/projects/vcs/mercurial/wizard.json @@ -7,7 +7,7 @@ "trDisplayName": "Mercurial Clone", "trDisplayCategory": "Import Project", "icon": "icon.png", - "enabled": "%{JS: [ %{Plugins} ].indexOf('Mercurial') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('Mercurial') >= 0}", "options": [ diff --git a/share/qtcreator/templates/wizards/projects/vcs/subversion/wizard.json b/share/qtcreator/templates/wizards/projects/vcs/subversion/wizard.json index 7048c37dd6..aef8a28b9a 100644 --- a/share/qtcreator/templates/wizards/projects/vcs/subversion/wizard.json +++ b/share/qtcreator/templates/wizards/projects/vcs/subversion/wizard.json @@ -7,7 +7,7 @@ "trDisplayName": "Subversion Checkout", "trDisplayCategory": "Import Project", "icon": "icon.png", - "enabled": "%{JS: [ %{Plugins} ].indexOf('Subversion') >= 0}", + "enabled": "%{JS: value('Plugins').indexOf('Subversion') >= 0}", "options": [ diff --git a/share/qtcreator/templates/wizards/qtcreatorplugin/myplugin.h b/share/qtcreator/templates/wizards/qtcreatorplugin/myplugin.h index 47a7b2e743..1342090ac7 100644 --- a/share/qtcreator/templates/wizards/qtcreatorplugin/myplugin.h +++ b/share/qtcreator/templates/wizards/qtcreatorplugin/myplugin.h @@ -19,11 +19,11 @@ class %PluginName%Plugin : public ExtensionSystem::IPlugin public: %PluginName%Plugin(); - ~%PluginName%Plugin(); + ~%PluginName%Plugin() override; - bool initialize(const QStringList &arguments, QString *errorString); - void extensionsInitialized(); - ShutdownFlag aboutToShutdown(); + bool initialize(const QStringList &arguments, QString *errorString) override; + void extensionsInitialized() override; + ShutdownFlag aboutToShutdown() override; private: void triggerAction(); diff --git a/share/qtcreator/templates/wizards/qtquick2-extension/object.h b/share/qtcreator/templates/wizards/qtquick2-extension/object.h index 72b47b9bf3..cabd5229db 100644 --- a/share/qtcreator/templates/wizards/qtquick2-extension/object.h +++ b/share/qtcreator/templates/wizards/qtquick2-extension/object.h @@ -13,8 +13,8 @@ class %ObjectName% : public QQuickItem Q_DISABLE_COPY(%ObjectName%) public: - %ObjectName%(QQuickItem *parent = nullptr); - ~%ObjectName%(); + explicit %ObjectName%(QQuickItem *parent = nullptr); + ~%ObjectName%() override; }; @if ! '%{Cpp:PragmaOnce}' |