diff options
author | Craig Scott <[email protected]> | 2021-06-02 16:54:21 +1000 |
---|---|---|
committer | Craig Scott <[email protected]> | 2021-06-04 16:54:52 +1000 |
commit | 1c4ba17015fe99da48ce73fab75ecc60cf9cb975 (patch) | |
tree | 1311d8cebc4007d43888477045ca534404f2f7ca /examples/quick/customitems | |
parent | 6432e00b954beec7d0c6bc9b70fed6191b87bd38 (diff) |
Refactor and update qml CMake API
The existing CMake API for qml modules had a number of
shortcomings. Refactor it to achieve the following:
- Clearly separate public and internal aspects.
- Re-use code from qtbase for adding plugins and module
targets rather than reimplementing close variations.
- Provide more robust and complete support for qmllint,
qmlcachegen and automatic generation of qmldir files.
- Reduce the steps needed for more common scenarios.
- Encourage the use of separate backing library and plugin
targets.
- Automatically generate the plugin class .cpp file where
possible.
- Specify .qml files directly through qml-specific API
elements rather than assuming they can be extracted
out of a set of resources.
[ChangeLog][QtQml] The qml CMake API has changed from 6.1
and is now out of Technical Preview status. The most
notable change is that .qml files should no longer be
specified as resources, there is dedicated handling for
them in the qt6_add_qml_module(). A related change is
that the qt6_target_qml_files() command has been replaced
by qt6_target_qml_sources(). More complete integration
with qmlcachegen, qmllint and qmldir generation is also
part of the CMake API.
Fixes: QTBUG-91621
Task-number: QTBUG-82598
Task-number: QTBUG-88763
Task-number: QTBUG-89274
Task-number: QTBUG-91444
Change-Id: I25aae1b0e89890394dfe2ba2824008164b2ca8d9
Reviewed-by: Qt CI Bot <[email protected]>
Reviewed-by: Ulf Hermann <[email protected]>
Diffstat (limited to 'examples/quick/customitems')
-rw-r--r-- | examples/quick/customitems/painteditem/CMakeLists.txt | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/examples/quick/customitems/painteditem/CMakeLists.txt b/examples/quick/customitems/painteditem/CMakeLists.txt index 533396a7cd..fa964778d0 100644 --- a/examples/quick/customitems/painteditem/CMakeLists.txt +++ b/examples/quick/customitems/painteditem/CMakeLists.txt @@ -24,11 +24,12 @@ qt6_add_qml_module(qmltextballoonplugin OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/TextBalloonPlugin" VERSION 1.0 URI "TextBalloonPlugin" - INSTALL_LOCATION ${INSTALL_EXAMPLEDIR} + PLUGIN_TARGET qmltextballoonplugin + QML_FILES textballoons.qml + RESOURCE_PREFIX "/painteditem" ) target_sources(qmltextballoonplugin PRIVATE - TextBalloonPlugin/plugin.h textballoon.cpp textballoon.h ) set_target_properties(qmltextballoonplugin PROPERTIES @@ -46,7 +47,6 @@ target_link_libraries(qmltextballoonplugin PUBLIC # Resources: set(painteditem_resource_files "textballoon.h" - "textballoons.qml" ) qt6_add_resources(qmltextballoonplugin "painteditem" @@ -61,10 +61,3 @@ install(TARGETS qmltextballoonplugin BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" ) - -set_target_properties(qmltextballoonplugin PROPERTIES - QT_QML_MODULE_VERSION 1.0 - QT_QML_MODULE_URI TextBalloonPlugin -) - -qt6_qml_type_registration(qmltextballoonplugin) |