diff options
author | Oliver Eftevaag <[email protected]> | 2021-11-08 14:59:43 +0100 |
---|---|---|
committer | Oliver Eftevaag <[email protected]> | 2021-11-11 12:11:40 +0100 |
commit | 750e7d946ca8c059151e91c57da243bdc787ea6e (patch) | |
tree | f335f1ee81989a9cdb0d73b3372c55be51e1c734 | |
parent | 28bfd773cac84d228df9e6bdcc9bed84d79935c5 (diff) |
Keyinteraction example: use qt_add_qml_module() in CMakeLists.txt
We want to use the new cmake api instead of qt6_add_resources()
The file structure has also been flattened a bit.
Task-number: QTBUG-98130
Pick-to: 6.2
Change-Id: I1651d25e2902bf6932b78c2224ee4ffe454b658d
Reviewed-by: Ulf Hermann <[email protected]>
-rw-r--r-- | examples/quick/keyinteraction/CMakeLists.txt | 51 | ||||
-rw-r--r-- | examples/quick/keyinteraction/ContextMenu.qml (renamed from examples/quick/keyinteraction/focus/Core/ContextMenu.qml) | 4 | ||||
-rw-r--r-- | examples/quick/keyinteraction/GridMenu.qml (renamed from examples/quick/keyinteraction/focus/Core/GridMenu.qml) | 4 | ||||
-rw-r--r-- | examples/quick/keyinteraction/ListMenu.qml (renamed from examples/quick/keyinteraction/focus/Core/ListMenu.qml) | 6 | ||||
-rw-r--r-- | examples/quick/keyinteraction/ListViewDelegate.qml (renamed from examples/quick/keyinteraction/focus/Core/ListViewDelegate.qml) | 4 | ||||
-rw-r--r-- | examples/quick/keyinteraction/TabMenu.qml (renamed from examples/quick/keyinteraction/focus/Core/TabMenu.qml) | 4 | ||||
-rw-r--r-- | examples/quick/keyinteraction/focus.qml (renamed from examples/quick/keyinteraction/focus/focus.qml) | 9 | ||||
-rw-r--r-- | examples/quick/keyinteraction/images/arrow.png (renamed from examples/quick/keyinteraction/focus/Core/images/arrow.png) | bin | 411 -> 411 bytes | |||
-rw-r--r-- | examples/quick/keyinteraction/images/qt-logo.png (renamed from examples/quick/keyinteraction/focus/Core/images/qt-logo.png) | bin | 5149 -> 5149 bytes | |||
-rw-r--r-- | examples/quick/keyinteraction/keyinteraction.qml | 6 | ||||
-rw-r--r-- | examples/quick/keyinteraction/keyinteraction.qrc | 16 |
11 files changed, 44 insertions, 60 deletions
diff --git a/examples/quick/keyinteraction/CMakeLists.txt b/examples/quick/keyinteraction/CMakeLists.txt index ffb8c8924a..e338c11024 100644 --- a/examples/quick/keyinteraction/CMakeLists.txt +++ b/examples/quick/keyinteraction/CMakeLists.txt @@ -1,13 +1,9 @@ -# Generated from keyinteraction.pro. - cmake_minimum_required(VERSION 3.16) project(keyinteraction 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") @@ -15,47 +11,36 @@ endif() set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/keyinteraction") -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(keyinteraction +qt_add_executable(keyinteractionexample WIN32 MACOSX_BUNDLE main.cpp ) -set_target_properties(keyinteraction PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE -) -target_link_libraries(keyinteraction PUBLIC +target_link_libraries(keyinteractionexample PRIVATE Qt::Core Qt::Gui Qt::Qml Qt::Quick ) - # Resources: -set(keyinteraction_resource_files - "focus/Core/ContextMenu.qml" - "focus/Core/GridMenu.qml" - "focus/Core/ListMenu.qml" - "focus/Core/ListViewDelegate.qml" - "focus/Core/TabMenu.qml" - "focus/Core/images/arrow.png" - "focus/Core/images/qt-logo.png" - "focus/focus.qml" - "keyinteraction.qml" -) - -qt6_add_resources(keyinteraction "keyinteraction" - PREFIX - "/keyinteraction" - FILES - ${keyinteraction_resource_files} +qt_add_qml_module(keyinteractionexample + URI keyinteraction + VERSION 1.0 + QML_FILES + "ContextMenu.qml" + "GridMenu.qml" + "ListMenu.qml" + "ListViewDelegate.qml" + "TabMenu.qml" + "focus.qml" + "keyinteraction.qml" + RESOURCES + "images/arrow.png" + "images/qt-logo.png" ) -install(TARGETS keyinteraction +install(TARGETS keyinteractionexample RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" diff --git a/examples/quick/keyinteraction/focus/Core/ContextMenu.qml b/examples/quick/keyinteraction/ContextMenu.qml index 31b5e1b83d..66dcdf3fe8 100644 --- a/examples/quick/keyinteraction/focus/Core/ContextMenu.qml +++ b/examples/quick/keyinteraction/ContextMenu.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.1 +import QtQuick FocusScope { id: container diff --git a/examples/quick/keyinteraction/focus/Core/GridMenu.qml b/examples/quick/keyinteraction/GridMenu.qml index 46b903457c..4b05785e1d 100644 --- a/examples/quick/keyinteraction/focus/Core/GridMenu.qml +++ b/examples/quick/keyinteraction/GridMenu.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.1 +import QtQuick FocusScope { id: menu diff --git a/examples/quick/keyinteraction/focus/Core/ListMenu.qml b/examples/quick/keyinteraction/ListMenu.qml index 694ae3cac6..97a37a714b 100644 --- a/examples/quick/keyinteraction/focus/Core/ListMenu.qml +++ b/examples/quick/keyinteraction/ListMenu.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 QtQml 2.1 -import QtQuick 2.1 +import QtQml +import QtQuick FocusScope { id: menu diff --git a/examples/quick/keyinteraction/focus/Core/ListViewDelegate.qml b/examples/quick/keyinteraction/ListViewDelegate.qml index 971e39cff1..9fe4949282 100644 --- a/examples/quick/keyinteraction/focus/Core/ListViewDelegate.qml +++ b/examples/quick/keyinteraction/ListViewDelegate.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.1 +import QtQuick Item { id: container diff --git a/examples/quick/keyinteraction/focus/Core/TabMenu.qml b/examples/quick/keyinteraction/TabMenu.qml index 9feb46afbc..7aa70a7dcb 100644 --- a/examples/quick/keyinteraction/focus/Core/TabMenu.qml +++ b/examples/quick/keyinteraction/TabMenu.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.1 +import QtQuick FocusScope { id: menu diff --git a/examples/quick/keyinteraction/focus/focus.qml b/examples/quick/keyinteraction/focus.qml index b3c79d7ead..1eef9b9981 100644 --- a/examples/quick/keyinteraction/focus/focus.qml +++ b/examples/quick/keyinteraction/focus.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,9 +48,8 @@ ** ****************************************************************************/ -import QtQml 2.1 -import QtQuick 2.1 -import "Core" +import QtQml +import QtQuick Rectangle { id: window @@ -151,7 +150,7 @@ Rectangle { } Image { - source: "Core/images/arrow.png" + source: "images/arrow.png" rotation: 90 anchors.verticalCenter: parent.verticalCenter diff --git a/examples/quick/keyinteraction/focus/Core/images/arrow.png b/examples/quick/keyinteraction/images/arrow.png Binary files differindex 20ee200f5f..20ee200f5f 100644 --- a/examples/quick/keyinteraction/focus/Core/images/arrow.png +++ b/examples/quick/keyinteraction/images/arrow.png diff --git a/examples/quick/keyinteraction/focus/Core/images/qt-logo.png b/examples/quick/keyinteraction/images/qt-logo.png Binary files differindex 14ddf2a028..14ddf2a028 100644 --- a/examples/quick/keyinteraction/focus/Core/images/qt-logo.png +++ b/examples/quick/keyinteraction/images/qt-logo.png diff --git a/examples/quick/keyinteraction/keyinteraction.qml b/examples/quick/keyinteraction/keyinteraction.qml index 7fa3078803..c79ba7217e 100644 --- a/examples/quick/keyinteraction/keyinteraction.qml +++ b/examples/quick/keyinteraction/keyinteraction.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,10 +48,10 @@ ** ****************************************************************************/ -import QtQuick 2.1 +import QtQuick Loader {//Just loader, since there's only one. - source: "focus/focus.qml" + source: "focus.qml" focus: true // Exception to the standard sizing, because this is primarily a desktop // example and it benefits from being able to see everything at once. diff --git a/examples/quick/keyinteraction/keyinteraction.qrc b/examples/quick/keyinteraction/keyinteraction.qrc index c719654835..8738ef9826 100644 --- a/examples/quick/keyinteraction/keyinteraction.qrc +++ b/examples/quick/keyinteraction/keyinteraction.qrc @@ -1,13 +1,13 @@ <RCC> <qresource prefix="/keyinteraction"> <file>keyinteraction.qml</file> - <file>focus/focus.qml</file> - <file>focus/Core/images/arrow.png</file> - <file>focus/Core/images/qt-logo.png</file> - <file>focus/Core/ContextMenu.qml</file> - <file>focus/Core/GridMenu.qml</file> - <file>focus/Core/ListMenu.qml</file> - <file>focus/Core/ListViewDelegate.qml</file> - <file>focus/Core/TabMenu.qml</file> + <file>focus.qml</file> + <file>ContextMenu.qml</file> + <file>GridMenu.qml</file> + <file>ListMenu.qml</file> + <file>ListViewDelegate.qml</file> + <file>TabMenu.qml</file> + <file>images/arrow.png</file> + <file>images/qt-logo.png</file> </qresource> </RCC> |