diff options
Diffstat (limited to 'examples/qml/tutorials/extending-qml/chapter2-methods')
-rw-r--r-- | examples/qml/tutorials/extending-qml/chapter2-methods/App.qml (renamed from examples/qml/tutorials/extending-qml/chapter2-methods/app.qml) | 0 | ||||
-rw-r--r-- | examples/qml/tutorials/extending-qml/chapter2-methods/CMakeLists.txt | 38 | ||||
-rw-r--r-- | examples/qml/tutorials/extending-qml/chapter2-methods/chapter2-methods.qrc | 5 | ||||
-rw-r--r-- | examples/qml/tutorials/extending-qml/chapter2-methods/main.cpp | 2 | ||||
-rw-r--r-- | examples/qml/tutorials/extending-qml/chapter2-methods/qmldir | 6 |
5 files changed, 30 insertions, 21 deletions
diff --git a/examples/qml/tutorials/extending-qml/chapter2-methods/app.qml b/examples/qml/tutorials/extending-qml/chapter2-methods/App.qml index 56597c3f42..56597c3f42 100644 --- a/examples/qml/tutorials/extending-qml/chapter2-methods/app.qml +++ b/examples/qml/tutorials/extending-qml/chapter2-methods/App.qml diff --git a/examples/qml/tutorials/extending-qml/chapter2-methods/CMakeLists.txt b/examples/qml/tutorials/extending-qml/chapter2-methods/CMakeLists.txt index f0906cf380..3fc7d3ffbf 100644 --- a/examples/qml/tutorials/extending-qml/chapter2-methods/CMakeLists.txt +++ b/examples/qml/tutorials/extending-qml/chapter2-methods/CMakeLists.txt @@ -1,19 +1,13 @@ # Copyright (C) 2022 The Qt Company Ltd. -# SPDX-License-Identifier: BSD-3-Clause +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause cmake_minimum_required(VERSION 3.16) project(chapter2-methods LANGUAGES CXX) -set(CMAKE_AUTOMOC ON) - -if(NOT DEFINED INSTALL_EXAMPLESDIR) - set(INSTALL_EXAMPLESDIR "examples") -endif() - -set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/qml/tutorials/extending-qml/chapter2-methods") - find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick) +qt_standard_project_setup(REQUIRES 6.5) + qt_add_executable(chapter2-methods main.cpp piechart.cpp piechart.h @@ -25,21 +19,29 @@ set_target_properties(chapter2-methods PROPERTIES ) target_link_libraries(chapter2-methods PUBLIC - Qt::Core - Qt::Gui - Qt::Qml - Qt::Quick + Qt6::Core + Qt6::Gui + Qt6::Qml + Qt6::Quick ) qt_add_qml_module(chapter2-methods URI Charts - QML_FILES app.qml - NO_RESOURCE_TARGET_PATH + QML_FILES App.qml DEPENDENCIES QtQuick ) install(TARGETS chapter2-methods - RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" - BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" - LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION . + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) + +qt_generate_deploy_qml_app_script( + TARGET chapter2-methods + OUTPUT_SCRIPT deploy_script + MACOS_BUNDLE_POST_BUILD + NO_UNSUPPORTED_PLATFORM_ERROR + DEPLOY_USER_QML_MODULES_ON_UNSUPPORTED_PLATFORM ) +install(SCRIPT ${deploy_script}) diff --git a/examples/qml/tutorials/extending-qml/chapter2-methods/chapter2-methods.qrc b/examples/qml/tutorials/extending-qml/chapter2-methods/chapter2-methods.qrc index f1168aef3b..c72f203e67 100644 --- a/examples/qml/tutorials/extending-qml/chapter2-methods/chapter2-methods.qrc +++ b/examples/qml/tutorials/extending-qml/chapter2-methods/chapter2-methods.qrc @@ -1,5 +1,6 @@ <RCC> - <qresource prefix="/"> - <file>app.qml</file> + <qresource prefix="/qt/qml/Charts"> + <file>App.qml</file> + <file>qmldir</file> </qresource> </RCC> diff --git a/examples/qml/tutorials/extending-qml/chapter2-methods/main.cpp b/examples/qml/tutorials/extending-qml/chapter2-methods/main.cpp index f2eaab03bc..bc4bbba809 100644 --- a/examples/qml/tutorials/extending-qml/chapter2-methods/main.cpp +++ b/examples/qml/tutorials/extending-qml/chapter2-methods/main.cpp @@ -11,7 +11,7 @@ int main(int argc, char *argv[]) QQuickView view; view.setResizeMode(QQuickView::SizeRootObjectToView); - view.setSource(QUrl("qrc:///app.qml")); + view.loadFromModule("Charts", "App"); view.show(); return QGuiApplication::exec(); } diff --git a/examples/qml/tutorials/extending-qml/chapter2-methods/qmldir b/examples/qml/tutorials/extending-qml/chapter2-methods/qmldir new file mode 100644 index 0000000000..e8b0c98311 --- /dev/null +++ b/examples/qml/tutorials/extending-qml/chapter2-methods/qmldir @@ -0,0 +1,6 @@ +module Charts +typeinfo chapter2-methods.qmltypes +depends QtQuick +prefer :/qt/qml/Charts/ +App 254.0 App.qml + |