QmlDesigner: Update application template for QDS projects

This updates the application template to download
the designer components.

* Added a cmake configure option BUILD_QDS_COMPONENTS
* We use the qds-3.9 branch of qtquickdesigner-components

Change-Id: I046e2c7e648fe9d3cb6cf8d2cec8eb606432bccd
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Thomas Hartmann
2022-12-08 16:37:07 +01:00
parent d0c9bc76cb
commit 56450a8fe6
11 changed files with 122 additions and 7 deletions

View File

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

View File

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

View File

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

View File

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

View File

@@ -5,6 +5,7 @@
#include <QQmlApplicationEngine>
#include "app_environment.h"
#include "import_qml_components_plugins.h"
#include "import_qml_plugins.h"
int main(int argc, char *argv[])

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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