aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick/draganddrop
diff options
context:
space:
mode:
authorOliver Eftevaag <oliver.eftevaag@qt.io>2021-09-06 11:25:52 +0200
committerOliver Eftevaag <oliver.eftevaag@qt.io>2021-10-06 01:03:51 +0200
commitb128136f80d7e456d2c779750a4e39d4168cf204 (patch)
tree68adcf0dce1240701dba52ad21404f34c707dfef /examples/quick/draganddrop
parent5ff83606a1c1365b95cd12ef9d45bc4e4eb13ecd (diff)
DragAndDrop example: Update CMakeLists.txt
This commit updates the drag and drop example to use qt_add_qml_module() in its CMakeLists.txt file. Pick-to: 6.2 Change-Id: I47fd28a1a114fe70986f73d4f2d87265255652a0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'examples/quick/draganddrop')
-rw-r--r--examples/quick/draganddrop/CMakeLists.txt77
-rw-r--r--examples/quick/draganddrop/draganddrop.qml6
-rw-r--r--examples/quick/draganddrop/views/gridview.qml8
3 files changed, 30 insertions, 61 deletions
diff --git a/examples/quick/draganddrop/CMakeLists.txt b/examples/quick/draganddrop/CMakeLists.txt
index 32db4a60f5..dea3d2c27d 100644
--- a/examples/quick/draganddrop/CMakeLists.txt
+++ b/examples/quick/draganddrop/CMakeLists.txt
@@ -7,7 +7,6 @@ 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")
@@ -15,71 +14,41 @@ endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/draganddrop")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Quick)
-find_package(Qt6 COMPONENTS Qml)
+find_package(Qt6 COMPONENTS Core Gui Quick Qml)
-qt_add_executable(draganddrop
+add_subdirectory("../shared" "shared")
+
+qt_add_executable(draganddropexample
+ WIN32
+ MACOSX_BUNDLE
main.cpp
)
-set_target_properties(draganddrop PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
+
+qt_add_qml_module(draganddropexample
+ URI draganddrop
+ VERSION 1.0
+ QML_FILES
+ "draganddrop.qml"
+ "tiles/DragTile.qml"
+ "tiles/DropTile.qml"
+ "tiles/tiles.qml"
+ "views/Icon.qml"
+ "views/gridview.qml"
)
-target_link_libraries(draganddrop PUBLIC
+
+target_link_libraries(draganddropexample PUBLIC
Qt::Core
Qt::Gui
Qt::Qml
Qt::Quick
)
+add_dependencies(draganddropexample draganddrop_shared)
-# Resources:
-set(draganddrop_resource_files
- "draganddrop.qml"
- "tiles/DragTile.qml"
- "tiles/DropTile.qml"
- "tiles/tiles.qml"
- "views/Icon.qml"
- "views/gridview.qml"
-)
-
-qt6_add_resources(draganddrop "draganddrop"
- PREFIX
- "/draganddrop"
- FILES
- ${draganddrop_resource_files}
-)
-set(shared_resource_files
- "../shared/Button.qml"
- "../shared/CheckBox.qml"
- "../shared/FlickrRssModel.qml"
- "../shared/Label.qml"
- "../shared/LauncherList.qml"
- "../shared/SimpleLauncherDelegate.qml"
- "../shared/Slider.qml"
- "../shared/TabSet.qml"
- "../shared/TextField.qml"
- "../shared/images/back.png"
- "../shared/images/checkmark.png"
- "../shared/images/next.png"
- "../shared/images/qt-logo.png"
- "../shared/images/slider_handle.png"
- "../shared/images/tab.png"
-)
-
-qt6_add_resources(draganddrop "shared"
- PREFIX
- "/shared"
- BASE
- "../shared"
- FILES
- ${shared_resource_files}
-)
-
-install(TARGETS draganddrop
+install(TARGETS draganddropexample
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)
+
+bundle_shared(draganddropexample)
diff --git a/examples/quick/draganddrop/draganddrop.qml b/examples/quick/draganddrop/draganddrop.qml
index b1fb6eb268..490223d7c0 100644
--- a/examples/quick/draganddrop/draganddrop.qml
+++ b/examples/quick/draganddrop/draganddrop.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,8 @@
**
****************************************************************************/
-import QtQuick 2.0
-import "../shared" as Examples
+import QtQuick
+import shared as Examples
Item {
height: 480
diff --git a/examples/quick/draganddrop/views/gridview.qml b/examples/quick/draganddrop/views/gridview.qml
index 05bd48e7fa..98a67ca513 100644
--- a/examples/quick/draganddrop/views/gridview.qml
+++ b/examples/quick/draganddrop/views/gridview.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2018 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,9 +48,9 @@
**
****************************************************************************/
-import QtQml 2.14
-import QtQuick 2.14
-import QtQml.Models 2.14
+import QtQml
+import QtQuick
+import QtQml.Models
GridView {
id: root