aboutsummaryrefslogtreecommitdiffstats
path: root/examples/qml/tutorials/extending-qml/chapter6-plugins
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@qt.io>2021-08-23 16:29:18 +1000
committerCraig Scott <craig.scott@qt.io>2021-08-24 16:08:21 +1000
commit9e1d2a0eb15487f8f2acb4d91b281568897fb4e1 (patch)
treee055ea022161b4dbbecbb94c2c1fa7c4a83a5ee8 /examples/qml/tutorials/extending-qml/chapter6-plugins
parent05bee5bb50378b76b6441895c533f50d99db445e (diff)
Update qml examples for improved target path handling
Some examples were still using the old "add as ordinary resources" approach for QML modules, others needed adjustment to the subdirectory structure to better reflect the URI structure of the QML modules involved. Task-number: QTBUG-95144 Pick-to: 6.2 Change-Id: Ie3399410cf6df491eb1e7b4a589ca26c577d82a0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'examples/qml/tutorials/extending-qml/chapter6-plugins')
-rw-r--r--examples/qml/tutorials/extending-qml/chapter6-plugins/.prev_CMakeLists.txt51
-rw-r--r--examples/qml/tutorials/extending-qml/chapter6-plugins/CMakeLists.txt19
-rw-r--r--examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/CMakeLists.txt (renamed from examples/qml/tutorials/extending-qml/chapter6-plugins/import/CMakeLists.txt)0
-rw-r--r--examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/Charts.pro (renamed from examples/qml/tutorials/extending-qml/chapter6-plugins/import/import.pro)4
-rw-r--r--examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/chartsplugin.h (renamed from examples/qml/tutorials/extending-qml/chapter6-plugins/import/chartsplugin.h)0
-rw-r--r--examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/piechart.cpp (renamed from examples/qml/tutorials/extending-qml/chapter6-plugins/import/piechart.cpp)0
-rw-r--r--examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/piechart.h (renamed from examples/qml/tutorials/extending-qml/chapter6-plugins/import/piechart.h)0
-rw-r--r--examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/pieslice.cpp (renamed from examples/qml/tutorials/extending-qml/chapter6-plugins/import/pieslice.cpp)0
-rw-r--r--examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/pieslice.h (renamed from examples/qml/tutorials/extending-qml/chapter6-plugins/import/pieslice.h)0
-rw-r--r--examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/qmldir (renamed from examples/qml/tutorials/extending-qml/chapter6-plugins/import/qmldir)0
-rw-r--r--examples/qml/tutorials/extending-qml/chapter6-plugins/chapter6-plugins.pro2
11 files changed, 7 insertions, 69 deletions
diff --git a/examples/qml/tutorials/extending-qml/chapter6-plugins/.prev_CMakeLists.txt b/examples/qml/tutorials/extending-qml/chapter6-plugins/.prev_CMakeLists.txt
deleted file mode 100644
index 0d68df497a..0000000000
--- a/examples/qml/tutorials/extending-qml/chapter6-plugins/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,51 +0,0 @@
-# Generated from chapter6-plugins.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(chapter6-plugins LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/qml/tutorials/extending-qml/chapter6-plugins")
-
-find_package(Qt6 COMPONENTS Qml)
-find_package(Qt6 COMPONENTS Quick)
-
-qt_add_executable(chapter6-plugins
- main.cpp
-)
-set_target_properties(chapter6-plugins PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(chapter6-plugins PUBLIC
- Qt::Qml
- Qt::Quick
-)
-
-
-# Resources:
-set(app_resource_files
- "app.qml"
-)
-
-qt6_add_resources(chapter6-plugins "app"
- PREFIX
- "/"
- FILES
- ${app_resource_files}
-)
-
-install(TARGETS chapter6-plugins
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
-add_subdirectory(import)
diff --git a/examples/qml/tutorials/extending-qml/chapter6-plugins/CMakeLists.txt b/examples/qml/tutorials/extending-qml/chapter6-plugins/CMakeLists.txt
index a85121d2f1..cf3d218c57 100644
--- a/examples/qml/tutorials/extending-qml/chapter6-plugins/CMakeLists.txt
+++ b/examples/qml/tutorials/extending-qml/chapter6-plugins/CMakeLists.txt
@@ -14,7 +14,6 @@ if(NOT DEFINED INSTALL_EXAMPLESDIR)
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/qml/tutorials/extending-qml/chapter6-plugins")
-set(QT_QML_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
find_package(Qt6 COMPONENTS Qml)
find_package(Qt6 COMPONENTS Quick)
@@ -31,17 +30,11 @@ target_link_libraries(chapter6-plugins PUBLIC
Qt::Quick
)
-
-# Resources:
-set(app_resource_files
- "app.qml"
-)
-
-qt6_add_resources(chapter6-plugins "app"
- PREFIX
- "/"
- FILES
- ${app_resource_files}
+qt_add_qml_module(chapter6-plugins
+ URI ChartsApp
+ VERSION 1.0
+ QML_FILES app.qml
+ NO_RESOURCE_TARGET_PATH
)
install(TARGETS chapter6-plugins
@@ -50,4 +43,4 @@ install(TARGETS chapter6-plugins
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)
-add_subdirectory(import)
+add_subdirectory(Charts)
diff --git a/examples/qml/tutorials/extending-qml/chapter6-plugins/import/CMakeLists.txt b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/CMakeLists.txt
index 15f6dcc2c2..15f6dcc2c2 100644
--- a/examples/qml/tutorials/extending-qml/chapter6-plugins/import/CMakeLists.txt
+++ b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/CMakeLists.txt
diff --git a/examples/qml/tutorials/extending-qml/chapter6-plugins/import/import.pro b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/Charts.pro
index c37cd1fdee..054ed06606 100644
--- a/examples/qml/tutorials/extending-qml/chapter6-plugins/import/import.pro
+++ b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/Charts.pro
@@ -17,10 +17,6 @@ SOURCES += piechart.cpp \
DESTPATH=$$[QT_INSTALL_EXAMPLES]/qml/tutorials/extending-qml/chapter6-plugins/$$QML_IMPORT_NAME
-copy_qmltypes.files = $$OUT_PWD/plugins.qmltypes
-copy_qmltypes.path = $$DESTDIR
-COPIES += copy_qmltypes
-
target.path=$$DESTPATH
qmldir.files=$$PWD/qmldir
qmldir.path=$$DESTPATH
diff --git a/examples/qml/tutorials/extending-qml/chapter6-plugins/import/chartsplugin.h b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/chartsplugin.h
index 780bb3a8f3..780bb3a8f3 100644
--- a/examples/qml/tutorials/extending-qml/chapter6-plugins/import/chartsplugin.h
+++ b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/chartsplugin.h
diff --git a/examples/qml/tutorials/extending-qml/chapter6-plugins/import/piechart.cpp b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/piechart.cpp
index 536c0e16ae..536c0e16ae 100644
--- a/examples/qml/tutorials/extending-qml/chapter6-plugins/import/piechart.cpp
+++ b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/piechart.cpp
diff --git a/examples/qml/tutorials/extending-qml/chapter6-plugins/import/piechart.h b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/piechart.h
index fbded1e3a2..fbded1e3a2 100644
--- a/examples/qml/tutorials/extending-qml/chapter6-plugins/import/piechart.h
+++ b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/piechart.h
diff --git a/examples/qml/tutorials/extending-qml/chapter6-plugins/import/pieslice.cpp b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/pieslice.cpp
index 1d30036929..1d30036929 100644
--- a/examples/qml/tutorials/extending-qml/chapter6-plugins/import/pieslice.cpp
+++ b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/pieslice.cpp
diff --git a/examples/qml/tutorials/extending-qml/chapter6-plugins/import/pieslice.h b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/pieslice.h
index 86602afe8f..86602afe8f 100644
--- a/examples/qml/tutorials/extending-qml/chapter6-plugins/import/pieslice.h
+++ b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/pieslice.h
diff --git a/examples/qml/tutorials/extending-qml/chapter6-plugins/import/qmldir b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/qmldir
index d9e8471b3c..d9e8471b3c 100644
--- a/examples/qml/tutorials/extending-qml/chapter6-plugins/import/qmldir
+++ b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/qmldir
diff --git a/examples/qml/tutorials/extending-qml/chapter6-plugins/chapter6-plugins.pro b/examples/qml/tutorials/extending-qml/chapter6-plugins/chapter6-plugins.pro
index f858c80876..2d78235454 100644
--- a/examples/qml/tutorials/extending-qml/chapter6-plugins/chapter6-plugins.pro
+++ b/examples/qml/tutorials/extending-qml/chapter6-plugins/chapter6-plugins.pro
@@ -1,5 +1,5 @@
TEMPLATE = subdirs
CONFIG += ordered
SUBDIRS = \
- import \
+ Charts \
app.pro