forked from qt-creator/qt-creator
QtQuick Application wizard: Add "QDS style project" option
This adds a checkbox labeled "Design Studio style project" to the Wizard. With that selected, the project is generated via the "General / Empty" templates of QDS with Qt 6.2 as target Qt version, 1920x1080 form size, the "Material" QtQuick.Controls style ("Light" Theme) and CMake project format. At the same time, the preexisting QtQuick Application wizard in Qt Creator now also focusses on Qt 6.2 and CMake. TS file generation is removed for now, can be added later, but then using the i18n setup feature of QQmlApplicationEngine (instead of a QTranslator in main.cpp). The wizard now focusses on the QML CMake API. In order to filter the kits accordingly, the flag "QtSupport.Wizards.FeatureQtQmlCMakeApi" was added. Task-number: QTCREATORBUG-28436 Change-Id: I80bc5585f31ec82c64f845701c768f8a07e000da Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -1,33 +0,0 @@
|
|||||||
cmake_minimum_required(VERSION 3.16)
|
|
||||||
|
|
||||||
project(%{ProjectName} VERSION 0.1 LANGUAGES CXX)
|
|
||||||
|
|
||||||
set(CMAKE_AUTOMOC ON)
|
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
||||||
|
|
||||||
find_package(Qt6 6.2 COMPONENTS Quick REQUIRED)
|
|
||||||
|
|
||||||
qt_add_executable(%{TargetName}
|
|
||||||
main.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
qt_add_qml_module(%{TargetName}
|
|
||||||
URI %{ProjectName}
|
|
||||||
VERSION 1.0
|
|
||||||
QML_FILES main.qml %{AdditionalQmlFiles}
|
|
||||||
)
|
|
||||||
|
|
||||||
set_target_properties(%{TargetName} PROPERTIES
|
|
||||||
MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
|
|
||||||
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
|
|
||||||
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
|
|
||||||
MACOSX_BUNDLE TRUE
|
|
||||||
WIN32_EXECUTABLE TRUE
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_libraries(%{TargetName}
|
|
||||||
PRIVATE Qt6::Quick)
|
|
||||||
|
|
||||||
install(TARGETS %{TargetName}
|
|
||||||
BUNDLE DESTINATION .
|
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
@@ -1,67 +1,23 @@
|
|||||||
cmake_minimum_required(VERSION 3.14)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
project(%{ProjectName} VERSION 0.1 LANGUAGES CXX)
|
project(%{ProjectName} VERSION 0.1 LANGUAGES CXX)
|
||||||
|
|
||||||
set(CMAKE_AUTOUIC ON)
|
|
||||||
set(CMAKE_AUTOMOC ON)
|
set(CMAKE_AUTOMOC ON)
|
||||||
set(CMAKE_AUTORCC ON)
|
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
@if %{HasTranslation}
|
find_package(Qt6 6.2 REQUIRED COMPONENTS Quick)
|
||||||
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Quick LinguistTools)
|
|
||||||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Quick LinguistTools)
|
|
||||||
|
|
||||||
set(TS_FILES %{TsFileName})
|
qt_add_executable(%{TargetName}
|
||||||
@else
|
main.cpp
|
||||||
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Quick)
|
|
||||||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Quick)
|
|
||||||
@endif
|
|
||||||
|
|
||||||
set(PROJECT_SOURCES
|
|
||||||
%{MainCppFileName}
|
|
||||||
qml.qrc
|
|
||||||
@if %{HasTranslation}
|
|
||||||
${TS_FILES}
|
|
||||||
@endif
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
qt_add_qml_module(%{TargetName}
|
||||||
qt_add_executable(%{ProjectName}
|
URI %{ProjectName}
|
||||||
MANUAL_FINALIZATION
|
VERSION 1.0
|
||||||
${PROJECT_SOURCES}
|
QML_FILES main.qml
|
||||||
)
|
)
|
||||||
# Define target properties for Android with Qt 6 as:
|
|
||||||
# set_property(TARGET %{ProjectName} APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
|
|
||||||
# ${CMAKE_CURRENT_SOURCE_DIR}/android)
|
|
||||||
# For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation
|
|
||||||
@if %{HasTranslation}
|
|
||||||
|
|
||||||
qt_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
|
set_target_properties(%{TargetName} PROPERTIES
|
||||||
@endif
|
|
||||||
else()
|
|
||||||
if(ANDROID)
|
|
||||||
add_library(%{ProjectName} SHARED
|
|
||||||
${PROJECT_SOURCES}
|
|
||||||
)
|
|
||||||
# Define properties for Android with Qt 5 after find_package() calls as:
|
|
||||||
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
|
|
||||||
else()
|
|
||||||
add_executable(%{ProjectName}
|
|
||||||
${PROJECT_SOURCES}
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
@if %{HasTranslation}
|
|
||||||
|
|
||||||
qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
|
|
||||||
@endif
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_link_libraries(%{ProjectName}
|
|
||||||
PRIVATE Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Quick)
|
|
||||||
|
|
||||||
set_target_properties(%{ProjectName} PROPERTIES
|
|
||||||
MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
|
MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
|
||||||
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
|
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
|
||||||
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
|
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
|
||||||
@@ -69,11 +25,10 @@ set_target_properties(%{ProjectName} PROPERTIES
|
|||||||
WIN32_EXECUTABLE TRUE
|
WIN32_EXECUTABLE TRUE
|
||||||
)
|
)
|
||||||
|
|
||||||
install(TARGETS %{ProjectName}
|
target_link_libraries(%{TargetName}
|
||||||
|
PRIVATE Qt6::Quick
|
||||||
|
)
|
||||||
|
|
||||||
|
install(TARGETS %{TargetName}
|
||||||
BUNDLE DESTINATION .
|
BUNDLE DESTINATION .
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
|
||||||
if(QT_VERSION_MAJOR EQUAL 6)
|
|
||||||
qt_import_qml_plugins(%{ProjectName})
|
|
||||||
qt_finalize_executable(%{ProjectName})
|
|
||||||
endif()
|
|
||||||
|
@@ -1,40 +0,0 @@
|
|||||||
@if "%{UseVirtualKeyboard}" == "true"
|
|
||||||
QT += quick virtualkeyboard
|
|
||||||
@else
|
|
||||||
QT += quick
|
|
||||||
@endif
|
|
||||||
@if !%{IsQt6}
|
|
||||||
|
|
||||||
# You can make your code fail to compile if it uses deprecated APIs.
|
|
||||||
# In order to do so, uncomment the following line.
|
|
||||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
|
||||||
@endif
|
|
||||||
|
|
||||||
SOURCES += \\
|
|
||||||
%{MainCppFileName}
|
|
||||||
|
|
||||||
@if %{IsQt6}
|
|
||||||
resources.files = main.qml %{AdditionalQmlFiles}
|
|
||||||
resources.prefix = /$${TARGET}
|
|
||||||
RESOURCES += resources
|
|
||||||
@else
|
|
||||||
RESOURCES += qml.qrc
|
|
||||||
@endif
|
|
||||||
@if %{HasTranslation}
|
|
||||||
|
|
||||||
TRANSLATIONS += \\
|
|
||||||
%{TsFileName}
|
|
||||||
CONFIG += lrelease
|
|
||||||
CONFIG += embed_translations
|
|
||||||
@endif
|
|
||||||
|
|
||||||
# Additional import path used to resolve QML modules in Qt Creator's code model
|
|
||||||
QML_IMPORT_PATH =
|
|
||||||
|
|
||||||
# Additional import path used to resolve QML modules just for Qt Quick Designer
|
|
||||||
QML_DESIGNER_IMPORT_PATH =
|
|
||||||
|
|
||||||
# Default rules for deployment.
|
|
||||||
qnx: target.path = /tmp/$${TARGET}/bin
|
|
||||||
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
|
||||||
!isEmpty(target.path): INSTALLS += target
|
|
@@ -1,48 +0,0 @@
|
|||||||
import qbs
|
|
||||||
|
|
||||||
CppApplication {
|
|
||||||
@if "%{UseVirtualKeyboard}" == "true"
|
|
||||||
Depends { name: "Qt"; submodules: ["quick", "virtualkeyboard"] }
|
|
||||||
@else
|
|
||||||
Depends { name: "Qt.quick" }
|
|
||||||
@endif
|
|
||||||
|
|
||||||
install: true
|
|
||||||
|
|
||||||
// Additional import path used to resolve QML modules in Qt Creator's code model
|
|
||||||
property pathList qmlImportPaths: []
|
|
||||||
@if !%{IsQt6}
|
|
||||||
|
|
||||||
cpp.defines: [
|
|
||||||
// You can make your code fail to compile if it uses deprecated APIs.
|
|
||||||
// In order to do so, uncomment the following line.
|
|
||||||
//"QT_DISABLE_DEPRECATED_BEFORE=0x060000" // disables all the APIs deprecated before Qt 6.0.0
|
|
||||||
]
|
|
||||||
@endif
|
|
||||||
|
|
||||||
files: [
|
|
||||||
"%{MainCppFileName}",
|
|
||||||
@if !%{IsQt6}
|
|
||||||
"main.qml",
|
|
||||||
"qml.qrc",
|
|
||||||
@endif
|
|
||||||
@if %{HasTranslation}
|
|
||||||
"%{TsFileName}",
|
|
||||||
@endif
|
|
||||||
]
|
|
||||||
@if %{HasTranslation}
|
|
||||||
|
|
||||||
Group {
|
|
||||||
fileTagsFilter: "qm"
|
|
||||||
Qt.core.resourcePrefix: "/i18n"
|
|
||||||
fileTags: "qt.core.resource_data"
|
|
||||||
}
|
|
||||||
@endif
|
|
||||||
@if %{IsQt6}
|
|
||||||
Group {
|
|
||||||
files: ["main.qml"%{AdditionalQmlFilesQbs}]
|
|
||||||
Qt.core.resourcePrefix: "%{ProjectName}/"
|
|
||||||
fileTags: ["qt.qml.qml", "qt.core.resource_data"]
|
|
||||||
}
|
|
||||||
@endif
|
|
||||||
}
|
|
@@ -1,5 +0,0 @@
|
|||||||
<RCC>
|
|
||||||
<qresource prefix="/">
|
|
||||||
<file>main.qml</file>
|
|
||||||
</qresource>
|
|
||||||
</RCC>
|
|
@@ -1,230 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 1,
|
|
||||||
"supportedProjectTypes": [ "CMakeProjectManager.CMakeProject", "Qbs.QbsProject", "Qt4ProjectManager.Qt4Project" ],
|
|
||||||
"id": "U.QtQuickApplicationEmpty",
|
|
||||||
"category": "D.ApplicationQt",
|
|
||||||
"trDescription": "Creates a Qt Quick application that contains an empty window.",
|
|
||||||
"trDisplayName": "Qt Quick Application",
|
|
||||||
"trDisplayCategory": "Application (Qt)",
|
|
||||||
"icon": "icon.png",
|
|
||||||
"iconKind": "Themed",
|
|
||||||
"featuresRequired": [ "QtSupport.Wizards.FeatureQt.5.6" ],
|
|
||||||
"enabled": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0 || value('Plugins').indexOf('QbsProjectManager') >= 0 || value('Plugins').indexOf('CMakeProjectManager') >= 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": "QbsFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'qbs')}" },
|
|
||||||
{ "key": "CMakeFile", "value": "%{ProjectDirectory}/CMakeLists.txt" },
|
|
||||||
{ "key": "IsQt6", "value": "%{JS: value('QtVersion').IsQt6}" },
|
|
||||||
{ "key": "MainCppFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src')}" },
|
|
||||||
{ "key": "QtQuickVersion", "value": "%{JS: value('QtVersion').QtQuickVersion}" },
|
|
||||||
{ "key": "QtQuickWindowVersion", "value": "%{JS: value('QtVersion').QtQuickWindowVersion}" },
|
|
||||||
{ "key": "QtQuickVirtualKeyboardImport", "value": "%{JS: value('QtVersion').QtQuickVirtualKeyboardImport}" },
|
|
||||||
{ "key": "QtQuickFeature", "value": "%{JS: (value('QtQuickVersion')=='') ? 'QtSupport.Wizards.FeatureQt.6.2' : 'QtSupport.Wizards.FeatureQtQuick.%{QtQuickVersion}'}" },
|
|
||||||
{ "key": "UseVirtualKeyboardByDefault", "value": "%{JS: value('Plugins').indexOf('Boot2Qt') >= 0 || value('Plugins').indexOf('Boot2QtQdb') >= 0}" },
|
|
||||||
{ "key": "HasTranslation", "value": "%{JS: value('TsFileName') !== ''}" },
|
|
||||||
{ "key": "SetQPAPhysicalSize", "value": "%{UseVirtualKeyboardByDefault}" },
|
|
||||||
{ "key": "AdditionalQmlFiles", "value": "" },
|
|
||||||
{ "key": "AdditionalQmlFilesQbs", "value": "" },
|
|
||||||
{ "key": "TargetName", "value": "%{JS: 'app' + value('ProjectName')}" }
|
|
||||||
],
|
|
||||||
|
|
||||||
"pages":
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"trDisplayName": "Project Location",
|
|
||||||
"trShortTitle": "Location",
|
|
||||||
"typeId": "Project"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"trDisplayName": "Define Build System",
|
|
||||||
"trShortTitle": "Build System",
|
|
||||||
"typeId": "Fields",
|
|
||||||
"enabled": "%{JS: !value('IsSubproject')}",
|
|
||||||
"data":
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"name": "BuildSystem",
|
|
||||||
"trDisplayName": "Build system:",
|
|
||||||
"type": "ComboBox",
|
|
||||||
"persistenceKey": "BuildSystemType",
|
|
||||||
"data":
|
|
||||||
{
|
|
||||||
"index": 1,
|
|
||||||
"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": "Define Project Details",
|
|
||||||
"trShortTitle": "Details",
|
|
||||||
"typeId": "Fields",
|
|
||||||
"data":
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"name": "QtVersion",
|
|
||||||
"trDisplayName": "Minimum required Qt version:",
|
|
||||||
"type": "ComboBox",
|
|
||||||
"persistenceKey": "QtQuick.minimumQtVersion",
|
|
||||||
"data":
|
|
||||||
{
|
|
||||||
"index": 1,
|
|
||||||
"items":
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"trKey": "Qt 6.2",
|
|
||||||
"value":
|
|
||||||
{
|
|
||||||
"QtQuickVersion": "",
|
|
||||||
"QtQuickWindowVersion": "",
|
|
||||||
"QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard",
|
|
||||||
"IsQt6": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"trKey": "Qt 5.15",
|
|
||||||
"value":
|
|
||||||
{
|
|
||||||
"QtQuickVersion": "2.15",
|
|
||||||
"QtQuickWindowVersion": "2.15",
|
|
||||||
"QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.15",
|
|
||||||
"IsQt6": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"trKey": "Qt 5.14",
|
|
||||||
"value":
|
|
||||||
{
|
|
||||||
"QtQuickVersion": "2.14",
|
|
||||||
"QtQuickWindowVersion": "2.14",
|
|
||||||
"QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.14",
|
|
||||||
"IsQt6": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"trKey": "Qt 5.13",
|
|
||||||
"value":
|
|
||||||
{
|
|
||||||
"QtQuickVersion": "2.13",
|
|
||||||
"QtQuickWindowVersion": "2.13",
|
|
||||||
"QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.4",
|
|
||||||
"IsQt6": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"trKey": "Qt 5.12",
|
|
||||||
"value":
|
|
||||||
{
|
|
||||||
"QtQuickVersion": "2.12",
|
|
||||||
"QtQuickWindowVersion": "2.12",
|
|
||||||
"QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.4",
|
|
||||||
"IsQt6": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "UseVirtualKeyboard",
|
|
||||||
"trDisplayName": "Use Qt Virtual Keyboard",
|
|
||||||
"type": "CheckBox",
|
|
||||||
"persistenceKey": "QtQuick.UseVirtualKeyboard.%{UseVirtualKeyboardByDefault}",
|
|
||||||
"data":
|
|
||||||
{
|
|
||||||
"checked": "%{UseVirtualKeyboardByDefault}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"trDisplayName": "Translation File",
|
|
||||||
"trShortTitle": "Translation",
|
|
||||||
"typeId": "QtTranslation"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"trDisplayName": "Kit Selection",
|
|
||||||
"trShortTitle": "Kits",
|
|
||||||
"typeId": "Kits",
|
|
||||||
"enabled": "%{JS: !value('IsSubproject')}",
|
|
||||||
"data": {
|
|
||||||
"projectFilePath": "%{ProjectFile}",
|
|
||||||
"requiredFeatures": [ "QtSupport.Wizards.FeatureQt", "%{QtQuickFeature}" ]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"trDisplayName": "Project Management",
|
|
||||||
"trShortTitle": "Summary",
|
|
||||||
"typeId": "Summary"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"generators":
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"typeId": "File",
|
|
||||||
"data":
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"source": "../app.pro",
|
|
||||||
"target": "%{ProFile}",
|
|
||||||
"openAsProject": true,
|
|
||||||
"condition": "%{JS: value('BuildSystem') === 'qmake'}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"source": "%{JS: value('QtVersion').IsQt6 ? '../CMakeLists.6.x.txt' : '../CMakeLists.txt'}",
|
|
||||||
"target": "CMakeLists.txt",
|
|
||||||
"openAsProject": true,
|
|
||||||
"condition": "%{JS: value('BuildSystem') === 'cmake'}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"source": "../app.qbs",
|
|
||||||
"target": "%{QbsFile}",
|
|
||||||
"openAsProject": true,
|
|
||||||
"condition": "%{JS: value('BuildSystem') === 'qbs'}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"source": "../main.cpp",
|
|
||||||
"target": "%{MainCppFileName}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"source": "main.qml.tpl",
|
|
||||||
"target": "main.qml",
|
|
||||||
"openInEditor": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"source": "qml.qrc",
|
|
||||||
"condition": "%{JS: !value('QtVersion').IsQt6}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"source": "../../translation.ts",
|
|
||||||
"target": "%{TsFileName}",
|
|
||||||
"condition": "%{HasTranslation}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"source": "../../git.ignore",
|
|
||||||
"target": ".gitignore",
|
|
||||||
"condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
Before Width: | Height: | Size: 228 B After Width: | Height: | Size: 228 B |
Before Width: | Height: | Size: 392 B After Width: | Height: | Size: 392 B |
@@ -1,52 +1,16 @@
|
|||||||
%{Cpp:LicenseTemplate}\
|
%{Cpp:LicenseTemplate}\
|
||||||
%{JS: QtSupport.qtIncludes([], ["QtGui/QGuiApplication", "QtQml/QQmlApplicationEngine"])}
|
%{JS: QtSupport.qtIncludes([], ["QtGui/QGuiApplication", "QtQml/QQmlApplicationEngine"])}
|
||||||
@if %{HasTranslation}
|
|
||||||
#include <QLocale>
|
|
||||||
#include <QTranslator>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@if %{UseVirtualKeyboard}
|
@if %{UseVirtualKeyboard}
|
||||||
qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
|
qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
|
||||||
|
|
||||||
@endif
|
|
||||||
@if !%{IsQt6}
|
|
||||||
@if %{SetQPAPhysicalSize}
|
|
||||||
if (qEnvironmentVariableIsEmpty("QTGLESSTREAM_DISPLAY")) {
|
|
||||||
qputenv("QT_QPA_EGLFS_PHYSICAL_WIDTH", QByteArray("213"));
|
|
||||||
qputenv("QT_QPA_EGLFS_PHYSICAL_HEIGHT", QByteArray("120"));
|
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
@else
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
||||||
#endif
|
|
||||||
@endif
|
|
||||||
@endif
|
@endif
|
||||||
QGuiApplication app(argc, argv);
|
QGuiApplication app(argc, argv);
|
||||||
@if %{HasTranslation}
|
|
||||||
|
|
||||||
QTranslator translator;
|
|
||||||
const QStringList uiLanguages = QLocale::system().uiLanguages();
|
|
||||||
for (const QString &locale : uiLanguages) {
|
|
||||||
const QString baseName = "%{JS: value('ProjectName') + '_'}" + QLocale(locale).name();
|
|
||||||
if (translator.load(":/i18n/" + baseName)) {
|
|
||||||
app.installTranslator(&translator);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@endif
|
|
||||||
|
|
||||||
QQmlApplicationEngine engine;
|
QQmlApplicationEngine engine;
|
||||||
@if %{IsQt6}
|
|
||||||
const QUrl url(u"qrc:/%{JS: value('ProjectName')}/main.qml"_qs);
|
const QUrl url(u"qrc:/%{JS: value('ProjectName')}/main.qml"_qs);
|
||||||
@else
|
|
||||||
const QUrl url(QStringLiteral("qrc:/main.qml"));
|
|
||||||
@endif
|
|
||||||
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
|
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
|
||||||
&app, [url](QObject *obj, const QUrl &objUrl) {
|
&app, [url](QObject *obj, const QUrl &objUrl) {
|
||||||
if (!obj && url == objUrl)
|
if (!obj && url == objUrl)
|
||||||
|
@@ -1,9 +1,7 @@
|
|||||||
import QtQuick %{QtQuickVersion}
|
import QtQuick
|
||||||
@if !%{IsQt6}
|
import QtQuick.Window
|
||||||
import QtQuick.Window %{QtQuickWindowVersion}
|
|
||||||
@endif
|
|
||||||
@if %{UseVirtualKeyboard}
|
@if %{UseVirtualKeyboard}
|
||||||
import %{QtQuickVirtualKeyboardImport}
|
import QtQuick.VirtualKeyboard
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
Window {
|
Window {
|
@@ -0,0 +1,244 @@
|
|||||||
|
{
|
||||||
|
"version": 1,
|
||||||
|
"supportedProjectTypes": [ "CMakeProjectManager.CMakeProject" ],
|
||||||
|
"id": "U.QtQuickApplicationEmpty",
|
||||||
|
"category": "D.ApplicationQt",
|
||||||
|
"trDescription": "Creates a Qt Quick application that contains an empty window. Optionally, you can create a Qt Design Studio project.",
|
||||||
|
"trDisplayName": "Qt Quick Application",
|
||||||
|
"trDisplayCategory": "Application (Qt)",
|
||||||
|
"icon": "icon.png",
|
||||||
|
"iconKind": "Themed",
|
||||||
|
"featuresRequired": [ "QtSupport.Wizards.FeatureQtQmlCMakeApi" ],
|
||||||
|
"enabled": "%{JS: value('Plugins').indexOf('CMakeProjectManager') >= 0 }",
|
||||||
|
|
||||||
|
"options":
|
||||||
|
[
|
||||||
|
{ "key": "ProjectFile", "value": "%{ProjectDirectory}/CMakeLists.txt" },
|
||||||
|
{ "key": "MainCppFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src') }" },
|
||||||
|
{ "key": "UseVirtualKeyboardByDefault", "value": "%{JS: value('Plugins').indexOf('Boot2Qt') >= 0 || value('Plugins').indexOf('Boot2QtQdb') >= 0 }" },
|
||||||
|
{ "key": "TargetName", "value": "%{JS: 'app' + value('ProjectName') }" },
|
||||||
|
{ "key": "QdsWizardPath", "value": "%{IDE:ResourcePath}/qmldesigner/studio_templates/projects" },
|
||||||
|
{ "key": "NoQdsProjectStyle", "value": "%{JS: !%{QdsProjectStyle} }" },
|
||||||
|
|
||||||
|
{ "key": "ImportModuleName", "value": "%{ProjectName}" },
|
||||||
|
{ "key": "ImportModuleVersion", "value": "" },
|
||||||
|
{ "key": "IsQt6Project", "value": true },
|
||||||
|
{ "key": "ProjectPluginClassName", "value": "%{ProjectName}Plugin" },
|
||||||
|
{ "key": "ProjectPluginName", "value": "%{ProjectName}plugin" },
|
||||||
|
{ "key": "QmlProjectFileName", "value": "%{JS: Util.fileName('%{ProjectName}', 'qmlproject')}" },
|
||||||
|
{ "key": "QtQuickControlsStyle", "value": "Material" },
|
||||||
|
{ "key": "QtQuickControlsStyleTheme", "value": "Light" },
|
||||||
|
{ "key": "QtQuickVersion", "value": "6.2" },
|
||||||
|
{ "key": "ScreenHeight", "value": 1080 },
|
||||||
|
{ "key": "ScreenWidth", "value": 1920 },
|
||||||
|
{ "key": "UIClassName", "value": "Screen01" },
|
||||||
|
{ "key": "UIClassFileName", "value": "%{JS: Util.fileName('%{UIClassName}', 'ui.qml')}" }
|
||||||
|
],
|
||||||
|
|
||||||
|
"pages":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"trDisplayName": "Project Location",
|
||||||
|
"trShortTitle": "Location",
|
||||||
|
"typeId": "Project"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trDisplayName": "Define Project Details",
|
||||||
|
"trShortTitle": "Details",
|
||||||
|
"typeId": "Fields",
|
||||||
|
"data":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "QdsProjectStyle",
|
||||||
|
"trDisplayName": "Create a project that you can open in Qt Design Studio",
|
||||||
|
"trToolTip": "Create a project with a structure that is compatible both with Qt Design Studio (via .qmlproject) and with Qt Creator (via CMakeLists.txt). It contains a .ui.qml form that you can visually edit in Qt Design Studio.",
|
||||||
|
"type": "CheckBox",
|
||||||
|
"span": true,
|
||||||
|
"persistenceKey": "QtQuick.QdsProjectStyle",
|
||||||
|
"data":
|
||||||
|
{
|
||||||
|
"checked": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "UseVirtualKeyboard",
|
||||||
|
"trDisplayName": "Use Qt Virtual Keyboard",
|
||||||
|
"type": "CheckBox",
|
||||||
|
"span": true,
|
||||||
|
"persistenceKey": "QtQuick.UseVirtualKeyboard",
|
||||||
|
"data":
|
||||||
|
{
|
||||||
|
"checked": "%{UseVirtualKeyboardByDefault}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trDisplayName": "Kit Selection",
|
||||||
|
"trShortTitle": "Kits",
|
||||||
|
"typeId": "Kits",
|
||||||
|
"enabled": "%{JS: !value('IsSubproject')}",
|
||||||
|
"data": {
|
||||||
|
"projectFilePath": "%{ProjectFile}",
|
||||||
|
"requiredFeatures": [ "QtSupport.Wizards.FeatureQtQmlCMakeApi" ]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trDisplayName": "Project Management",
|
||||||
|
"trShortTitle": "Summary",
|
||||||
|
"typeId": "Summary"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"generators":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"typeId": "File",
|
||||||
|
"data":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"source": "CMakeLists.txt",
|
||||||
|
"openAsProject": true,
|
||||||
|
"condition": "%{NoQdsProjectStyle}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "main.cpp",
|
||||||
|
"target": "%{MainCppFileName}",
|
||||||
|
"condition": "%{NoQdsProjectStyle}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "main.qml.tpl",
|
||||||
|
"target": "main.qml",
|
||||||
|
"openInEditor": true,
|
||||||
|
"condition": "%{NoQdsProjectStyle}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "../git.ignore",
|
||||||
|
"target": ".gitignore",
|
||||||
|
"condition": "%{JS: %{NoQdsProjectStyle} && !value('IsSubproject') && value('VersionControl') === 'G.Git' }"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"typeId": "File",
|
||||||
|
"data":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"source": "%{QdsWizardPath}/common/app.qmlproject.tpl",
|
||||||
|
"target": "%{ProjectDirectory}/%{QmlProjectFileName}",
|
||||||
|
"condition": "%{QdsProjectStyle}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "%{QdsWizardPath}/common/CMakeLists.main.txt.tpl",
|
||||||
|
"target": "%{ProjectDirectory}/CMakeLists.txt",
|
||||||
|
"openAsProject": true,
|
||||||
|
"condition": "%{QdsProjectStyle}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "%{QdsWizardPath}/common/qmlmodules.tpl",
|
||||||
|
"target": "%{ProjectDirectory}/qmlmodules",
|
||||||
|
"condition": "%{QdsProjectStyle}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "%{QdsWizardPath}/common/qmlcomponents.tpl",
|
||||||
|
"target": "%{ProjectDirectory}/qmlcomponents",
|
||||||
|
"condition": "%{QdsProjectStyle}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "%{QdsWizardPath}/common/main.qml",
|
||||||
|
"target": "%{ProjectDirectory}/main.qml",
|
||||||
|
"condition": "%{QdsProjectStyle}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "%{QdsWizardPath}/common/qtquickcontrols2.conf.tpl",
|
||||||
|
"target": "%{ProjectDirectory}/qtquickcontrols2.conf",
|
||||||
|
"condition": "%{QdsProjectStyle}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "%{QdsWizardPath}/common/main.cpp.tpl",
|
||||||
|
"target": "%{ProjectDirectory}/src/main.cpp",
|
||||||
|
"condition": "%{QdsProjectStyle}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "%{QdsWizardPath}/common/app_environment.h.tpl",
|
||||||
|
"target": "%{ProjectDirectory}/src/app_environment.h",
|
||||||
|
"condition": "%{QdsProjectStyle}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "%{QdsWizardPath}/common/import_qml_plugins.h.tpl",
|
||||||
|
"target": "%{ProjectDirectory}/src/import_qml_plugins.h",
|
||||||
|
"condition": "%{QdsProjectStyle}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "%{QdsWizardPath}/common/import_qml_components_plugins.h.tpl",
|
||||||
|
"target": "%{ProjectDirectory}/src/import_qml_components_plugins.h",
|
||||||
|
"condition": "%{QdsProjectStyle}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "%{QdsWizardPath}/common/CMakeLists.content.txt.tpl",
|
||||||
|
"target": "%{ProjectDirectory}/content/CMakeLists.txt",
|
||||||
|
"condition": "%{QdsProjectStyle}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "%{QdsWizardPath}/common/App.qml.tpl",
|
||||||
|
"target": "%{ProjectDirectory}/content/App.qml",
|
||||||
|
"condition": "%{QdsProjectStyle}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "%{QdsWizardPath}/application/Screen01.ui.qml.tpl",
|
||||||
|
"target": "%{ProjectDirectory}/content/Screen01.ui.qml",
|
||||||
|
"condition": "%{QdsProjectStyle}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "%{QdsWizardPath}/common/fonts.txt",
|
||||||
|
"target": "%{ProjectDirectory}/content/fonts/fonts.txt",
|
||||||
|
"condition": "%{QdsProjectStyle}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "%{QdsWizardPath}/common/asset_imports.txt",
|
||||||
|
"target": "%{ProjectDirectory}/asset_imports/asset_imports.txt",
|
||||||
|
"condition": "%{QdsProjectStyle}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "%{QdsWizardPath}/common/CMakeLists.imports.txt.tpl",
|
||||||
|
"target": "%{ProjectDirectory}/imports/CMakeLists.txt",
|
||||||
|
"condition": "%{QdsProjectStyle}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "%{QdsWizardPath}/shared-plugin/name/CMakeLists.importmodule.txt.tpl",
|
||||||
|
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/CMakeLists.txt",
|
||||||
|
"condition": "%{QdsProjectStyle}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "%{QdsWizardPath}/shared-plugin/name/importmodule.qmldir.tpl",
|
||||||
|
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/qmldir",
|
||||||
|
"condition": "%{QdsProjectStyle}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "%{QdsWizardPath}/shared-plugin/name/Constants.qml.tpl",
|
||||||
|
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/Constants.qml",
|
||||||
|
"condition": "%{QdsProjectStyle}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "%{QdsWizardPath}/shared-plugin/name/DirectoryFontLoader.qml.tpl",
|
||||||
|
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/DirectoryFontLoader.qml",
|
||||||
|
"condition": "%{QdsProjectStyle}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "%{QdsWizardPath}/shared-plugin/name/EventListModel.qml.tpl",
|
||||||
|
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/EventListModel.qml",
|
||||||
|
"condition": "%{QdsProjectStyle}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "%{QdsWizardPath}/shared-plugin/name/EventListSimulator.qml.tpl",
|
||||||
|
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/EventListSimulator.qml",
|
||||||
|
"condition": "%{QdsProjectStyle}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "%{QdsWizardPath}/shared-plugin/name/designer/plugin.metainfo",
|
||||||
|
"target": "%{ProjectDirectory}/imports/%{ImportModuleName}/designer/plugin.metainfo",
|
||||||
|
"condition": "%{QdsProjectStyle}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@@ -419,6 +419,11 @@ QSet<Id> QtVersion::availableFeatures() const
|
|||||||
features.unite(versionedIds(Constants::FEATURE_QT_QUICK_PREFIX, 6, -1));
|
features.unite(versionedIds(Constants::FEATURE_QT_QUICK_PREFIX, 6, -1));
|
||||||
features.unite(versionedIds(Constants::FEATURE_QT_QUICK_CONTROLS_2_PREFIX, 6, -1));
|
features.unite(versionedIds(Constants::FEATURE_QT_QUICK_CONTROLS_2_PREFIX, 6, -1));
|
||||||
|
|
||||||
|
if (QVersionNumber(6, 1).isPrefixOf(qtVersion()))
|
||||||
|
return features;
|
||||||
|
|
||||||
|
features.insert(Constants::FEATURE_QT_QML_CMAKE_API);
|
||||||
|
|
||||||
return features;
|
return features;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -29,6 +29,7 @@ const char FEATURE_QT_QUICK_UI_FILES[] = "QtSupport.Wizards.FeatureQtQuick.UiFil
|
|||||||
const char FEATURE_QT_WEBKIT[] = "QtSupport.Wizards.FeatureQtWebkit";
|
const char FEATURE_QT_WEBKIT[] = "QtSupport.Wizards.FeatureQtWebkit";
|
||||||
const char FEATURE_QT_3D[] = "QtSupport.Wizards.FeatureQt3d";
|
const char FEATURE_QT_3D[] = "QtSupport.Wizards.FeatureQt3d";
|
||||||
const char FEATURE_QT_CANVAS3D_PREFIX[] = "QtSupport.Wizards.FeatureQtCanvas3d";
|
const char FEATURE_QT_CANVAS3D_PREFIX[] = "QtSupport.Wizards.FeatureQtCanvas3d";
|
||||||
|
const char FEATURE_QT_QML_CMAKE_API[] = "QtSupport.Wizards.FeatureQtQmlCMakeApi";
|
||||||
const char FEATURE_QT_CONSOLE[] = "QtSupport.Wizards.FeatureQtConsole";
|
const char FEATURE_QT_CONSOLE[] = "QtSupport.Wizards.FeatureQtConsole";
|
||||||
const char FEATURE_MOBILE[] = "QtSupport.Wizards.FeatureMobile";
|
const char FEATURE_MOBILE[] = "QtSupport.Wizards.FeatureMobile";
|
||||||
const char FEATURE_DESKTOP[] = "QtSupport.Wizards.FeatureDesktop";
|
const char FEATURE_DESKTOP[] = "QtSupport.Wizards.FeatureDesktop";
|
||||||
|
@@ -2181,7 +2181,7 @@
|
|||||||
inkscape:connector-curvature="0" />
|
inkscape:connector-curvature="0" />
|
||||||
</g>
|
</g>
|
||||||
<g
|
<g
|
||||||
id="share/qtcreator/templates/wizards/projects/qtquickapplication/empty/icon"
|
id="share/qtcreator/templates/wizards/projects/qtquickapplication/icon"
|
||||||
transform="translate(-23,-82)">
|
transform="translate(-23,-82)">
|
||||||
<use
|
<use
|
||||||
style="display:inline"
|
style="display:inline"
|
||||||
|
Before Width: | Height: | Size: 356 KiB After Width: | Height: | Size: 356 KiB |
Reference in New Issue
Block a user