diff --git a/share/qtcreator/qmldesigner/studio_templates/projects/application-3d/wizard.json b/share/qtcreator/qmldesigner/studio_templates/projects/application-3d/wizard.json index 6c6949442c6..84690258ea3 100644 --- a/share/qtcreator/qmldesigner/studio_templates/projects/application-3d/wizard.json +++ b/share/qtcreator/qmldesigner/studio_templates/projects/application-3d/wizard.json @@ -299,6 +299,10 @@ "source": "../common/qmlmodules.tpl", "target": "%{ProjectDirectory}/qmlmodules" }, + { + "source": "../common/qmlcomponents.tpl", + "target": "%{ProjectDirectory}/qmlcomponents" + }, { "source": "../common/main.qml", "target": "%{ProjectDirectory}/main.qml" @@ -319,6 +323,11 @@ "source": "../common/import_qml_plugins.h.tpl", "target": "%{ProjectDirectory}/src/import_qml_plugins.h" }, + { + "source": "../common/import_qml_components_plugins.h.tpl", + "target": "%{ProjectDirectory}/src/import_qml_components_plugins.h" + }, + { "source": "../common/CMakeLists.content.txt.tpl", "target": "%{ProjectDirectory}/content/CMakeLists.txt" diff --git a/share/qtcreator/qmldesigner/studio_templates/projects/application/wizard.json b/share/qtcreator/qmldesigner/studio_templates/projects/application/wizard.json index 235116a1f4c..85f248f957b 100644 --- a/share/qtcreator/qmldesigner/studio_templates/projects/application/wizard.json +++ b/share/qtcreator/qmldesigner/studio_templates/projects/application/wizard.json @@ -295,6 +295,10 @@ "source": "../common/qmlmodules.tpl", "target": "%{ProjectDirectory}/qmlmodules" }, + { + "source": "../common/qmlcomponents.tpl", + "target": "%{ProjectDirectory}/qmlcomponents" + }, { "source": "../common/main.qml", "target": "%{ProjectDirectory}/main.qml" @@ -315,6 +319,10 @@ "source": "../common/import_qml_plugins.h.tpl", "target": "%{ProjectDirectory}/src/import_qml_plugins.h" }, + { + "source": "../common/import_qml_components_plugins.h.tpl", + "target": "%{ProjectDirectory}/src/import_qml_components_plugins.h" + }, { "source": "../common/CMakeLists.content.txt.tpl", "target": "%{ProjectDirectory}/content/CMakeLists.txt" diff --git a/share/qtcreator/qmldesigner/studio_templates/projects/common/CMakeLists.main.txt.tpl b/share/qtcreator/qmldesigner/studio_templates/projects/common/CMakeLists.main.txt.tpl index f105c83c553..6878a1023c3 100644 --- a/share/qtcreator/qmldesigner/studio_templates/projects/common/CMakeLists.main.txt.tpl +++ b/share/qtcreator/qmldesigner/studio_templates/projects/common/CMakeLists.main.txt.tpl @@ -1,24 +1,37 @@ -cmake_minimum_required(VERSION 3.18) +cmake_minimum_required(VERSION 3.21.1) + +set(BUILD_QDS_COMPONENTS ON CACHE BOOL "Build design studio components") project(%{ProjectName}App LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON) -find_package(Qt6 COMPONENTS Gui Qml Quick) -qt_add_executable(%{ProjectExecutableName} src/main.cpp) +find_package(QT NAMES Qt6 COMPONENTS Gui Qml Quick) +find_package(Qt6 REQUIRED COMPONENTS Core Qml Quick) -qt_add_resources(%{ProjectExecutableName} "configuration" +qt_add_executable(${CMAKE_PROJECT_NAME} src/main.cpp) + +# qt_standard_project_setup() requires Qt 6.3 or higher. See https://doc.qt.io/qt-6/qt-standard-project-setup.html for details. +if (${QT_VERSION_MINOR} GREATER_EQUAL 3) +qt6_standard_project_setup() +endif() + +qt_add_resources(${CMAKE_PROJECT_NAME} "configuration" PREFIX "/" FILES qtquickcontrols2.conf ) -target_link_libraries(%{ProjectExecutableName} PRIVATE +target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Quick Qt${QT_VERSION_MAJOR}::Qml ) +if (${BUILD_QDS_COMPONENTS}) + include(${CMAKE_CURRENT_SOURCE_DIR}/qmlcomponents) +endif () + include(${CMAKE_CURRENT_SOURCE_DIR}/qmlmodules) diff --git a/share/qtcreator/qmldesigner/studio_templates/projects/common/import_qml_components_plugins.h.tpl b/share/qtcreator/qmldesigner/studio_templates/projects/common/import_qml_components_plugins.h.tpl new file mode 100644 index 00000000000..25d0a98384e --- /dev/null +++ b/share/qtcreator/qmldesigner/studio_templates/projects/common/import_qml_components_plugins.h.tpl @@ -0,0 +1,19 @@ +/* + * This file is automatically generated by Qt Design Studio. + * Do not change. +*/ + +#include "qqmlextensionplugin.h" + +#ifdef BULD_QDS_COMPONENTS + +Q_IMPORT_QML_PLUGIN(QtQuick_Studio_ComponentsPlugin) +Q_IMPORT_QML_PLUGIN(QtQuick_Studio_EffectsPlugin) +Q_IMPORT_QML_PLUGIN(QtQuick_Studio_ApplicationPlugin) +Q_IMPORT_QML_PLUGIN(FlowViewPlugin) +Q_IMPORT_QML_PLUGIN(QtQuick_Studio_LogicHelperPlugin) +Q_IMPORT_QML_PLUGIN(QtQuick_Studio_MultiTextPlugin) +Q_IMPORT_QML_PLUGIN(QtQuick_Studio_EventSimulatorPlugin) +Q_IMPORT_QML_PLUGIN(QtQuick_Studio_EventSystemPlugin) + +#endif diff --git a/share/qtcreator/qmldesigner/studio_templates/projects/common/main.cpp.tpl b/share/qtcreator/qmldesigner/studio_templates/projects/common/main.cpp.tpl index f10adc57d72..cd28d11f3e5 100644 --- a/share/qtcreator/qmldesigner/studio_templates/projects/common/main.cpp.tpl +++ b/share/qtcreator/qmldesigner/studio_templates/projects/common/main.cpp.tpl @@ -5,6 +5,7 @@ #include #include "app_environment.h" +#include "import_qml_components_plugins.h" #include "import_qml_plugins.h" int main(int argc, char *argv[]) diff --git a/share/qtcreator/qmldesigner/studio_templates/projects/common/qmlcomponents.tpl b/share/qtcreator/qmldesigner/studio_templates/projects/common/qmlcomponents.tpl new file mode 100644 index 00000000000..3619df33d33 --- /dev/null +++ b/share/qtcreator/qmldesigner/studio_templates/projects/common/qmlcomponents.tpl @@ -0,0 +1,33 @@ +### This file is automatically generated by Qt Design Studio. +### Do not change + +message("Building designer components.") + +set(QT_QML_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/qml") + +include(FetchContent) +FetchContent_Declare( + ds + GIT_TAG qds-3.9 + GIT_REPOSITORY https://code.qt.io/qt-labs/qtquickdesigner-components.git +) + +FetchContent_GetProperties(ds) +FetchContent_Populate(ds) + +target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE + QuickStudioComponentsplugin + QuickStudioEffectsplugin + QuickStudioApplicationplugin + FlowViewplugin + QuickStudioLogicHelperplugin + QuickStudioMultiTextplugin + QuickStudioEventSimulatorplugin + QuickStudioEventSystemplugin +) + +add_subdirectory(${ds_SOURCE_DIR} ${ds_BINARY_DIR}) + +target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE + BULD_QDS_COMPONENTS=true +) diff --git a/share/qtcreator/qmldesigner/studio_templates/projects/common/qmlmodules.tpl b/share/qtcreator/qmldesigner/studio_templates/projects/common/qmlmodules.tpl index 1a3303600d4..fa3069a770a 100644 --- a/share/qtcreator/qmldesigner/studio_templates/projects/common/qmlmodules.tpl +++ b/share/qtcreator/qmldesigner/studio_templates/projects/common/qmlmodules.tpl @@ -1,7 +1,7 @@ ### This file is automatically generated by Qt Design Studio. ### Do not change -qt6_add_qml_module(%{ProjectExecutableName} +qt6_add_qml_module(${CMAKE_PROJECT_NAME} URI "Main" VERSION 1.0 NO_PLUGIN @@ -11,7 +11,7 @@ qt6_add_qml_module(%{ProjectExecutableName} add_subdirectory(content) add_subdirectory(imports) -target_link_libraries(%{ProjectExecutableName} PRIVATE +target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE contentplugin %{ProjectPluginName} ) diff --git a/share/qtcreator/qmldesigner/studio_templates/projects/desktop-launcher/wizard.json b/share/qtcreator/qmldesigner/studio_templates/projects/desktop-launcher/wizard.json index 851e3780899..92cbd476cdf 100644 --- a/share/qtcreator/qmldesigner/studio_templates/projects/desktop-launcher/wizard.json +++ b/share/qtcreator/qmldesigner/studio_templates/projects/desktop-launcher/wizard.json @@ -293,6 +293,10 @@ "source": "../common/qmlmodules.tpl", "target": "%{ProjectDirectory}/qmlmodules" }, + { + "source": "../common/qmlcomponents.tpl", + "target": "%{ProjectDirectory}/qmlcomponents" + }, { "source": "../common/main.qml", "target": "%{ProjectDirectory}/main.qml" @@ -313,6 +317,10 @@ "source": "../common/import_qml_plugins.h.tpl", "target": "%{ProjectDirectory}/src/import_qml_plugins.h" }, + { + "source": "../common/import_qml_components_plugins.h.tpl", + "target": "%{ProjectDirectory}/src/import_qml_components_plugins.h" + }, { "source": "../common/CMakeLists.content.txt.tpl", "target": "%{ProjectDirectory}/content/CMakeLists.txt" diff --git a/share/qtcreator/qmldesigner/studio_templates/projects/mobile-scroll/wizard.json b/share/qtcreator/qmldesigner/studio_templates/projects/mobile-scroll/wizard.json index 37e40ff8baf..9b3fe1be77a 100644 --- a/share/qtcreator/qmldesigner/studio_templates/projects/mobile-scroll/wizard.json +++ b/share/qtcreator/qmldesigner/studio_templates/projects/mobile-scroll/wizard.json @@ -252,6 +252,10 @@ "source": "../common/qmlmodules.tpl", "target": "%{ProjectDirectory}/qmlmodules" }, + { + "source": "../common/qmlcomponents.tpl", + "target": "%{ProjectDirectory}/qmlcomponents" + }, { "source": "../common/main.qml", "target": "%{ProjectDirectory}/main.qml" @@ -272,6 +276,10 @@ "source": "../common/import_qml_plugins.h.tpl", "target": "%{ProjectDirectory}/src/import_qml_plugins.h" }, + { + "source": "../common/import_qml_components_plugins.h.tpl", + "target": "%{ProjectDirectory}/src/import_qml_components_plugins.h" + }, { "source": "../common/CMakeLists.content.txt.tpl", "target": "%{ProjectDirectory}/content/CMakeLists.txt" diff --git a/share/qtcreator/qmldesigner/studio_templates/projects/mobile-stack/wizard.json b/share/qtcreator/qmldesigner/studio_templates/projects/mobile-stack/wizard.json index 642cd7a8e46..a10fe57da6c 100644 --- a/share/qtcreator/qmldesigner/studio_templates/projects/mobile-stack/wizard.json +++ b/share/qtcreator/qmldesigner/studio_templates/projects/mobile-stack/wizard.json @@ -249,6 +249,10 @@ "source": "../common/qmlmodules.tpl", "target": "%{ProjectDirectory}/qmlmodules" }, + { + "source": "../common/qmlcomponents.tpl", + "target": "%{ProjectDirectory}/qmlcomponents" + }, { "source": "../common/main.qml", "target": "%{ProjectDirectory}/main.qml" @@ -269,6 +273,10 @@ "source": "../common/import_qml_plugins.h.tpl", "target": "%{ProjectDirectory}/src/import_qml_plugins.h" }, + { + "source": "../common/import_qml_components_plugins.h.tpl", + "target": "%{ProjectDirectory}/src/import_qml_components_plugins.h" + }, { "source": "CMakeLists.content.txt.tpl", "target": "%{ProjectDirectory}/content/CMakeLists.txt" diff --git a/share/qtcreator/qmldesigner/studio_templates/projects/mobile-swipe/wizard.json b/share/qtcreator/qmldesigner/studio_templates/projects/mobile-swipe/wizard.json index a2ece501ad2..77c31a7d3bf 100644 --- a/share/qtcreator/qmldesigner/studio_templates/projects/mobile-swipe/wizard.json +++ b/share/qtcreator/qmldesigner/studio_templates/projects/mobile-swipe/wizard.json @@ -249,6 +249,10 @@ "source": "../common/qmlmodules.tpl", "target": "%{ProjectDirectory}/qmlmodules" }, + { + "source": "../common/qmlcomponents.tpl", + "target": "%{ProjectDirectory}/qmlcomponents" + }, { "source": "../common/main.qml", "target": "%{ProjectDirectory}/main.qml" @@ -269,6 +273,10 @@ "source": "../common/import_qml_plugins.h.tpl", "target": "%{ProjectDirectory}/src/import_qml_plugins.h" }, + { + "source": "../common/import_qml_components_plugins.h.tpl", + "target": "%{ProjectDirectory}/src/import_qml_components_plugins.h" + }, { "source": "CMakeLists.content.txt.tpl", "target": "%{ProjectDirectory}/content/CMakeLists.txt"