diff options
author | Oliver Eftevaag <oliver.eftevaag@qt.io> | 2021-08-30 12:15:04 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-09-03 15:10:43 +0000 |
commit | 2fd57fa2d05e9779b4ed7b9a1f04ed706726092e (patch) | |
tree | fb535ad2d2050454da47fb290c9dd7a573f8818a /examples/quick | |
parent | 5e16641b777f0ad27ac3dfc07bc8ebfbd4c00031 (diff) |
Clean up flipable example
Turning the project structure to be inline with Ulf's ideas.
Such as using qt_add_qml_module().
Previously the path to 5_heart.png and 9_club.png were broken.
This patch updates the path in the qml file, in order to make sure that
the resource is actually loaded.
It also adds a CMakeLists.txt, since it didn't already have one.
Change-Id: I4b2ffbfcfff7d2d63d7aab9fd7b40f77c1a1073c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 713bb3ce8f7f61c1d37c6842d1bb9b792e423b25)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'examples/quick')
-rw-r--r-- | examples/quick/customitems/flipable/5_heart.png (renamed from examples/quick/customitems/flipable/content/5_heart.png) | bin | 3872 -> 3872 bytes | |||
-rw-r--r-- | examples/quick/customitems/flipable/9_club.png (renamed from examples/quick/customitems/flipable/content/9_club.png) | bin | 6135 -> 6135 bytes | |||
-rw-r--r-- | examples/quick/customitems/flipable/CMakeLists.txt | 49 | ||||
-rw-r--r-- | examples/quick/customitems/flipable/Card.qml (renamed from examples/quick/customitems/flipable/content/Card.qml) | 4 | ||||
-rw-r--r-- | examples/quick/customitems/flipable/back.png (renamed from examples/quick/customitems/flipable/content/back.png) | bin | 1418 -> 1418 bytes | |||
-rw-r--r-- | examples/quick/customitems/flipable/flipable.qml | 9 | ||||
-rw-r--r-- | examples/quick/customitems/flipable/flipable.qrc | 10 | ||||
-rw-r--r-- | examples/quick/customitems/flipable/main.cpp | 4 |
8 files changed, 62 insertions, 14 deletions
diff --git a/examples/quick/customitems/flipable/content/5_heart.png b/examples/quick/customitems/flipable/5_heart.png Binary files differindex fb59d81453..fb59d81453 100644 --- a/examples/quick/customitems/flipable/content/5_heart.png +++ b/examples/quick/customitems/flipable/5_heart.png diff --git a/examples/quick/customitems/flipable/content/9_club.png b/examples/quick/customitems/flipable/9_club.png Binary files differindex 2545001904..2545001904 100644 --- a/examples/quick/customitems/flipable/content/9_club.png +++ b/examples/quick/customitems/flipable/9_club.png diff --git a/examples/quick/customitems/flipable/CMakeLists.txt b/examples/quick/customitems/flipable/CMakeLists.txt new file mode 100644 index 0000000000..469cde10ee --- /dev/null +++ b/examples/quick/customitems/flipable/CMakeLists.txt @@ -0,0 +1,49 @@ +# Generated from flipable.pro. + +cmake_minimum_required(VERSION 3.16) + +project(flipable LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) + +if(NOT DEFINED INSTALL_EXAMPLESDIR) + set(INSTALL_EXAMPLESDIR "examples") +endif() + +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/customitems/flipable") + +find_package(Qt6 COMPONENTS Core Gui Quick Qml) + +qt_add_executable(flipableexample + WIN32 + MACOSX_BUNDLE + main.cpp +) + +target_link_libraries(flipableexample PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick +) + +qt_add_qml_module(flipableexample + URI flipable + VERSION 1.0 + QML_FILES + "flipable.qml" + "Card.qml" + RESOURCES + "5_heart.png" + "9_club.png" + "back.png" +) + +install(TARGETS flipableexample + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/quick/customitems/flipable/content/Card.qml b/examples/quick/customitems/flipable/Card.qml index ffffdb6b7d..bc50bbe473 100644 --- a/examples/quick/customitems/flipable/content/Card.qml +++ b/examples/quick/customitems/flipable/Card.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. @@ -48,7 +48,7 @@ ** ****************************************************************************/ -import QtQuick 2.0 +import QtQuick Flipable { id: container diff --git a/examples/quick/customitems/flipable/content/back.png b/examples/quick/customitems/flipable/back.png Binary files differindex f715d7487e..f715d7487e 100644 --- a/examples/quick/customitems/flipable/content/back.png +++ b/examples/quick/customitems/flipable/back.png diff --git a/examples/quick/customitems/flipable/flipable.qml b/examples/quick/customitems/flipable/flipable.qml index 3662898864..c22eb841b0 100644 --- a/examples/quick/customitems/flipable/flipable.qml +++ b/examples/quick/customitems/flipable/flipable.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. @@ -48,8 +48,7 @@ ** ****************************************************************************/ -import QtQuick 2.0 -import "content" +import QtQuick Rectangle { id: window @@ -59,7 +58,7 @@ Rectangle { Row { anchors.centerIn: parent; spacing: 30 - Card { source: "content/9_club.png"; angle: 180; yAxis: 1 } - Card { source: "content/5_heart.png"; angle: 540; xAxis: 1 } + Card { source: "9_club.png"; angle: 180; yAxis: 1 } + Card { source: "5_heart.png"; angle: 540; xAxis: 1 } } } diff --git a/examples/quick/customitems/flipable/flipable.qrc b/examples/quick/customitems/flipable/flipable.qrc index 7918ccf00e..b7bc2f3021 100644 --- a/examples/quick/customitems/flipable/flipable.qrc +++ b/examples/quick/customitems/flipable/flipable.qrc @@ -1,9 +1,9 @@ <RCC> - <qresource prefix="/"> + <qresource prefix="/flipable"> <file>flipable.qml</file> - <file>content/5_heart.png</file> - <file>content/9_club.png</file> - <file>content/back.png</file> - <file>content/Card.qml</file> + <file>5_heart.png</file> + <file>9_club.png</file> + <file>back.png</file> + <file>Card.qml</file> </qresource> </RCC> diff --git a/examples/quick/customitems/flipable/main.cpp b/examples/quick/customitems/flipable/main.cpp index a0f0d67d45..6a4967bc65 100644 --- a/examples/quick/customitems/flipable/main.cpp +++ b/examples/quick/customitems/flipable/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2020 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. @@ -48,4 +48,4 @@ ** ****************************************************************************/ #include "../../shared/shared.h" -DECLARATIVE_EXAMPLE_MAIN(flipable) +DECLARATIVE_EXAMPLE_MAIN(flipable/flipable) |