aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/quick/mousearea/CMakeLists.txt35
-rw-r--r--examples/quick/mousearea/mousearea-wheel-example.qml4
-rw-r--r--examples/quick/mousearea/mousearea.qml6
3 files changed, 15 insertions, 30 deletions
diff --git a/examples/quick/mousearea/CMakeLists.txt b/examples/quick/mousearea/CMakeLists.txt
index 190e34b172..ea635462be 100644
--- a/examples/quick/mousearea/CMakeLists.txt
+++ b/examples/quick/mousearea/CMakeLists.txt
@@ -1,13 +1,9 @@
-# Generated from mousearea.pro.
-
cmake_minimum_required(VERSION 3.16)
project(mousearea 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,19 +11,12 @@ endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/mousearea")
-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(mousearea
+qt_add_executable(mouseareaexample WIN32 MACOSX_BUNDLE
main.cpp
)
-set_target_properties(mousearea PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(mousearea PUBLIC
+target_link_libraries(mouseareaexample PUBLIC
Qt::Core
Qt::Gui
Qt::Qml
@@ -36,19 +25,15 @@ target_link_libraries(mousearea PUBLIC
# Resources:
-set(mousearea_resource_files
- "mousearea-wheel-example.qml"
- "mousearea.qml"
-)
-
-qt6_add_resources(mousearea "mousearea"
- PREFIX
- "/mousearea"
- FILES
- ${mousearea_resource_files}
+qt_add_qml_module(mouseareaexample
+ URI mousearea
+ VERSION 1.0
+ QML_FILES
+ "mousearea-wheel-example.qml"
+ "mousearea.qml"
)
-install(TARGETS mousearea
+install(TARGETS mouseareaexample
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
diff --git a/examples/quick/mousearea/mousearea-wheel-example.qml b/examples/quick/mousearea/mousearea-wheel-example.qml
index 5e8fba3ac3..77893fd57c 100644
--- a/examples/quick/mousearea/mousearea-wheel-example.qml
+++ b/examples/quick/mousearea/mousearea-wheel-example.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
Rectangle {
height: 700
diff --git a/examples/quick/mousearea/mousearea.qml b/examples/quick/mousearea/mousearea.qml
index ff792f952d..677b5f384d 100644
--- a/examples/quick/mousearea/mousearea.qml
+++ b/examples/quick/mousearea/mousearea.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.4
+import QtQuick
Rectangle {
id: box
@@ -177,7 +177,7 @@ Rectangle {
id: info
anchors.bottom: btn.top; anchors.horizontalCenter: parent.horizontalCenter; anchors.margins: 20
- onTextChanged: console.log(text)
+ onTextChanged: function(text) { console.log(text) }
}
Text {