diff options
author | Oliver Eftevaag <oliver.eftevaag@qt.io> | 2021-08-23 11:27:37 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-09-03 08:56:05 +0000 |
commit | cf68bf4e7e48cf44c95e06f9dffe36ed2f40326a (patch) | |
tree | 2b3996b634c5bc3d5305712dc4758690e531e3ac /examples | |
parent | 7753f42027acbb5b4b711f4f6879ed924b8ee7cf (diff) |
ExternalDragAndDrop example: Use controls from Qt Quick Controls 2
This patch changes the external drag and drop example to use qqc2
checkboxes instead of a custom made component.
It also changes the position of the checkbox in order to avoid having
the label text overlap with it.
Task-number: QTBUG-95736
Change-Id: If3e798ea0ccd64921138690c7599876ec0584038
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit 8976c46f46e4559913948748148ce42c33a6c138)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'examples')
4 files changed, 16 insertions, 40 deletions
diff --git a/examples/quick/externaldraganddrop/CMakeLists.txt b/examples/quick/externaldraganddrop/CMakeLists.txt index 216b0bc5ac..d02f7488cf 100644 --- a/examples/quick/externaldraganddrop/CMakeLists.txt +++ b/examples/quick/externaldraganddrop/CMakeLists.txt @@ -47,32 +47,6 @@ qt6_add_resources(externaldraganddrop "externaldraganddrop" FILES ${externaldraganddrop_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(externaldraganddrop "shared" - PREFIX - "/shared" - BASE - "../shared" - FILES - ${shared_resource_files} -) install(TARGETS externaldraganddrop RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" diff --git a/examples/quick/externaldraganddrop/DragAndDropTextItem.qml b/examples/quick/externaldraganddrop/DragAndDropTextItem.qml index 605dc07434..ada96d2172 100644 --- a/examples/quick/externaldraganddrop/DragAndDropTextItem.qml +++ b/examples/quick/externaldraganddrop/DragAndDropTextItem.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.2 -import "../shared" as Examples +import QtQuick +import QtQuick.Controls Rectangle { id: item @@ -62,8 +62,9 @@ Rectangle { to: "#EEE" duration: 1000 } - Text { + Label { anchors.fill: parent + anchors.margins: 10 text: item.display wrapMode: Text.WordWrap } @@ -104,9 +105,9 @@ Rectangle { item.display = "" } } - Examples.CheckBox { + CheckBox { id: acceptDropCB - anchors.right: parent.right + anchors.bottom: parent.bottom checked: true text: "accept drop" } diff --git a/examples/quick/externaldraganddrop/externaldraganddrop.pro b/examples/quick/externaldraganddrop/externaldraganddrop.pro index 0a592a84f3..cd456f9b27 100644 --- a/examples/quick/externaldraganddrop/externaldraganddrop.pro +++ b/examples/quick/externaldraganddrop/externaldraganddrop.pro @@ -2,7 +2,7 @@ TEMPLATE = app QT += quick qml SOURCES += main.cpp -RESOURCES += externaldraganddrop.qrc ../shared/shared.qrc +RESOURCES += externaldraganddrop.qrc EXAMPLE_FILES = \ externaldraganddrop.qml \ diff --git a/examples/quick/externaldraganddrop/externaldraganddrop.qml b/examples/quick/externaldraganddrop/externaldraganddrop.qml index 47a76a259a..05742ff409 100644 --- a/examples/quick/externaldraganddrop/externaldraganddrop.qml +++ b/examples/quick/externaldraganddrop/externaldraganddrop.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,9 @@ ** ****************************************************************************/ -import QtQuick 2.2 -import QtQuick.Layouts 1.0 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts Item { id: root @@ -61,7 +62,7 @@ Item { anchors.fill: parent anchors.margins: 8 - Text { + Label { Layout.fillWidth: true text: "Drag text into, out of, and between the boxes below." wrapMode: Text.WordWrap @@ -69,19 +70,19 @@ Item { DragAndDropTextItem { Layout.fillWidth: true - height: 142 + Layout.fillHeight: true display: "Sample Text" } DragAndDropTextItem { Layout.fillWidth: true - height: 142 + Layout.fillHeight: true display: "Option/ctrl drag to copy instead of move text." } DragAndDropTextItem { Layout.fillWidth: true - height: 142 + Layout.fillHeight: true dropEnabled: false display: "Drag out into other applications." } |