aboutsummaryrefslogtreecommitdiffstats
path: root/tests/manual/quickcontrols2/dialogs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual/quickcontrols2/dialogs')
-rw-r--r--tests/manual/quickcontrols2/dialogs/CMakeLists.txt32
-rw-r--r--tests/manual/quickcontrols2/dialogs/FileDialogPage.qml357
-rw-r--r--tests/manual/quickcontrols2/dialogs/FontDialogPage.qml222
-rw-r--r--tests/manual/quickcontrols2/dialogs/StringListView.qml79
-rw-r--r--tests/manual/quickcontrols2/dialogs/Theme.qml57
-rw-r--r--tests/manual/quickcontrols2/dialogs/dialogs.cpp80
-rw-r--r--tests/manual/quickcontrols2/dialogs/dialogs.pro12
-rw-r--r--tests/manual/quickcontrols2/dialogs/dialogs.qml128
-rw-r--r--tests/manual/quickcontrols2/dialogs/qmldir3
9 files changed, 970 insertions, 0 deletions
diff --git a/tests/manual/quickcontrols2/dialogs/CMakeLists.txt b/tests/manual/quickcontrols2/dialogs/CMakeLists.txt
new file mode 100644
index 0000000000..cc132f36e4
--- /dev/null
+++ b/tests/manual/quickcontrols2/dialogs/CMakeLists.txt
@@ -0,0 +1,32 @@
+if (NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(dialogs LANGUAGES C CXX ASM)
+ find_package(Qt6BuildInternals COMPONENTS STANDALONE_TEST)
+endif()
+
+qt_internal_add_manual_test(dialogs
+ GUI
+ SOURCES
+ dialogs.cpp
+ PUBLIC_LIBRARIES
+ Qt::Gui
+ Qt::Qml
+ Qt::QuickControls2
+)
+
+# Resources:
+set(qmake_immediate_resource_files
+ "dialogs.qml"
+ "FileDialogPage.qml"
+ "FontDialogPage.qml"
+ "StringListView.qml"
+ "qmldir"
+ "Theme.qml"
+)
+
+qt_internal_add_resource(dialogs "qmake_immediate"
+ PREFIX
+ "/"
+ FILES
+ ${qmake_immediate_resource_files}
+)
diff --git a/tests/manual/quickcontrols2/dialogs/FileDialogPage.qml b/tests/manual/quickcontrols2/dialogs/FileDialogPage.qml
new file mode 100644
index 0000000000..9faad47e49
--- /dev/null
+++ b/tests/manual/quickcontrols2/dialogs/FileDialogPage.qml
@@ -0,0 +1,357 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Dialogs
+import QtQuick.Layouts
+
+import "."
+
+ColumnLayout {
+ property alias dialog: fileDialog
+
+ // Put it all in another ColumnLayout so we can easily add margins.
+ ColumnLayout {
+ Layout.leftMargin: 12
+ Layout.rightMargin: 12
+ Layout.topMargin: 12
+ Layout.bottomMargin: 12
+
+ GroupBox {
+ title: qsTr("Dialog properties")
+
+ Layout.fillWidth: true
+
+ GridLayout {
+ columns: 2
+ anchors.fill: parent
+
+ Label {
+ text: qsTr("modality")
+
+ Layout.alignment: Qt.AlignTop
+ Layout.minimumWidth: ApplicationWindow.window.width * 0.2
+ Layout.maximumWidth: ApplicationWindow.window.width * 0.2
+ }
+ ButtonGroup {
+ id: modalityButtonGroup
+ buttons: modalityColumnLayout.children
+ }
+ ColumnLayout {
+ id: modalityColumnLayout
+
+ RadioButton {
+ text: qsTr("Qt.NonModal")
+
+ readonly property int modality: Qt.NonModal
+ }
+ RadioButton {
+ text: qsTr("Qt.WindowModal")
+ checked: true
+
+ readonly property int modality: Qt.WindowModal
+ }
+ RadioButton {
+ text: qsTr("Qt.ApplicationModal")
+
+ readonly property int modality: Qt.ApplicationModal
+ }
+ }
+
+ Label {
+ text: qsTr("result")
+ }
+ TextField {
+ id: resultTextField
+ text: fileDialog.result === 1 ? qsTr("Accepted") : qsTr("Rejected")
+ readOnly: true
+ enabled: false
+ }
+
+ Label {
+ text: qsTr("title")
+ }
+ TextField {
+ id: titleTextField
+ text: qsTr("Choose a file")
+ }
+ }
+ }
+
+ GroupBox {
+ title: qsTr("FileDialog properties")
+
+ Layout.fillWidth: true
+
+ GridLayout {
+ columns: 2
+ anchors.fill: parent
+
+ Label {
+ text: qsTr("acceptLabel")
+
+ Layout.minimumWidth: ApplicationWindow.window.width * 0.2
+ Layout.maximumWidth: ApplicationWindow.window.width * 0.2
+ }
+ TextField {
+ id: acceptLabelTextField
+ text: qsTr("OK")
+ }
+
+ Label {
+ text: qsTr("currentFile")
+ }
+ TextField {
+ id: currentFileTextField
+ text: fileDialog.currentFile
+ readOnly: true
+ selectByMouse: true
+
+ Layout.fillWidth: true
+ }
+
+ Label {
+ text: qsTr("currentFolder")
+ }
+ TextField {
+ id: currentFolderTextField
+ text: fileDialog.currentFolder
+ readOnly: true
+ selectByMouse: true
+
+ Layout.fillWidth: true
+ }
+
+ Label {
+ text: qsTr("currentFiles")
+
+ Layout.alignment: Qt.AlignTop
+ }
+ StringListView {
+ id: currentFilesListView
+ // QTBUG-72906
+ model: [].concat(fileDialog.currentFiles)
+ }
+
+ Label {
+ text: qsTr("fileOptions")
+
+ Layout.alignment: Qt.AlignTop
+ }
+ ColumnLayout {
+ id: fileOptionsColumnLayout
+
+ CheckBox {
+ id: dontResolveSymlinksCheckBox
+ text: qsTr("DontResolveSymlinks")
+
+ readonly property int fileOption: checked ? FileDialog.DontResolveSymlinks : 0
+ }
+ CheckBox {
+ id: dontConfirmOverwriteCheckBox
+ text: qsTr("DontConfirmOverwrite")
+
+ readonly property int fileOption: checked ? FileDialog.DontConfirmOverwrite : 0
+ }
+ CheckBox {
+ id: readOnlyCheckBox
+ text: qsTr("ReadOnly")
+
+ readonly property int fileOption: checked ? FileDialog.ReadOnly : 0
+ }
+ CheckBox {
+ id: hideNameFilterDetailsCheckBox
+ text: qsTr("HideNameFilterDetails")
+
+ readonly property int fileOption: checked ? FileDialog.HideNameFilterDetails : 0
+ }
+ }
+
+ Label {
+ text: qsTr("fileMode")
+
+ Layout.alignment: Qt.AlignTop
+ }
+ ButtonGroup {
+ id: fileModeButtonGroup
+ buttons: fileModeColumnLayout.children
+ }
+ ColumnLayout {
+ id: fileModeColumnLayout
+
+ RadioButton {
+ text: qsTr("OpenFile")
+
+ readonly property int fileMode: FileDialog.OpenFile
+ }
+ RadioButton {
+ text: qsTr("OpenFiles")
+ checked: true
+
+ readonly property int fileMode: FileDialog.OpenFiles
+ }
+ RadioButton {
+ text: qsTr("SaveFile")
+
+ readonly property int fileMode: FileDialog.SaveFile
+ }
+ }
+
+ Label {
+ text: qsTr("nameFilters")
+ }
+ TextField {
+ id: nameFiltersTextField
+ text: ["Text files (*.txt)", "HTML files (*.html)"].join(",")
+
+ Layout.fillWidth: true
+
+ ToolTip.text: qsTr("For this example, a comma-separated string")
+ ToolTip.visible: hovered
+ ToolTip.delay: Theme.toolTipDelay
+ }
+
+ Label {
+ text: qsTr("rejectLabel")
+ }
+ TextField {
+ id: rejectLabelTextField
+ text: qsTr("Cancel")
+ }
+
+ Label {
+ text: qsTr("selectedFile")
+ }
+ TextField {
+ id: selectedFileTextField
+ text: fileDialog.selectedFile
+ readOnly: true
+ selectByMouse: true
+
+ Layout.fillWidth: true
+ }
+
+ Label {
+ text: qsTr("selectedFiles")
+
+ Layout.alignment: Qt.AlignTop
+ }
+ StringListView {
+ id: selectedFilesListView
+ // QTBUG-72906
+ model: [].concat(fileDialog.selectedFiles)
+ }
+
+ Label {
+ text: qsTr("selectedNameFilter.name")
+ }
+ TextField {
+ id: selectedNameFilterNameTextField
+ text: fileDialog.selectedNameFilter.name
+ readOnly: true
+ selectByMouse: true
+
+ Layout.fillWidth: true
+ }
+
+ Label {
+ text: qsTr("selectedNameFilter.globs")
+
+ Layout.alignment: Qt.AlignTop
+ }
+ StringListView {
+ id: selectedNameFilterGlobsListView
+ // QTBUG-72906
+ model: [].concat(fileDialog.selectedNameFilter.globs)
+ }
+
+ Label {
+ text: qsTr("selectedNameFilter.index")
+ }
+ TextField {
+ id: selectedNameFilterIndexTextField
+ text: fileDialog.selectedNameFilter.index
+ readOnly: true
+ selectByMouse: true
+
+ Layout.fillWidth: true
+ }
+
+ Label {
+ text: qsTr("selectedNameFilter.extensions")
+
+ Layout.alignment: Qt.AlignTop
+ }
+ StringListView {
+ id: selectedNameFilterExtensionsListView
+ // QTBUG-72906
+ model: [].concat(fileDialog.selectedNameFilter.extensions)
+ }
+ }
+ }
+
+ FileDialog {
+ id: fileDialog
+
+ modality: modalityButtonGroup.checkedButton.modality
+ title: titleTextField.text
+
+ acceptLabel: acceptLabelTextField.text
+ fileMode: fileModeButtonGroup.checkedButton.fileMode
+ options: dontResolveSymlinksCheckBox.fileOption
+ | dontConfirmOverwriteCheckBox.fileOption
+ | readOnlyCheckBox.fileOption
+ | hideNameFilterDetailsCheckBox.fileOption
+ nameFilters: nameFiltersTextField.text.split(",")
+ rejectLabel: rejectLabelTextField.text
+ }
+ }
+}
diff --git a/tests/manual/quickcontrols2/dialogs/FontDialogPage.qml b/tests/manual/quickcontrols2/dialogs/FontDialogPage.qml
new file mode 100644
index 0000000000..5b5d103445
--- /dev/null
+++ b/tests/manual/quickcontrols2/dialogs/FontDialogPage.qml
@@ -0,0 +1,222 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick
+import QtQuick.Controls
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Dialogs
+import QtQuick.Layouts
+
+import "."
+
+ColumnLayout {
+ property alias dialog: fontDialog
+
+ // Put it all in another ColumnLayout so we can easily add margins.
+ ColumnLayout {
+ Layout.leftMargin: 12
+ Layout.rightMargin: 12
+ Layout.topMargin: 12
+ Layout.bottomMargin: 12
+
+ GroupBox {
+ title: qsTr("Dialog properties")
+
+ Layout.fillWidth: true
+
+ GridLayout {
+ columns: 2
+ anchors.fill: parent
+
+ Label {
+ text: qsTr("modality")
+
+ Layout.alignment: Qt.AlignTop
+ Layout.minimumWidth: ApplicationWindow.window.width * 0.2
+ Layout.maximumWidth: ApplicationWindow.window.width * 0.2
+ }
+ ButtonGroup {
+ id: modalityButtonGroup
+ buttons: modalityColumnLayout.children
+ }
+ ColumnLayout {
+ id: modalityColumnLayout
+
+ RadioButton {
+ text: qsTr("Qt.NonModal")
+
+ readonly property int modality: Qt.NonModal
+ }
+ RadioButton {
+ text: qsTr("Qt.WindowModal")
+ checked: true
+
+ readonly property int modality: Qt.WindowModal
+ }
+ RadioButton {
+ text: qsTr("Qt.ApplicationModal")
+
+ readonly property int modality: Qt.ApplicationModal
+ }
+ }
+
+ Label {
+ text: qsTr("result")
+ }
+ TextField {
+ id: resultTextField
+ text: fontDialog.result === 1 ? qsTr("Accepted") : qsTr("Rejected")
+ readOnly: true
+ enabled: false
+ }
+
+ Label {
+ text: qsTr("title")
+ }
+ TextField {
+ id: titleTextField
+ text: qsTr("Pick a font")
+ }
+ }
+ }
+
+ GroupBox {
+ title: qsTr("FontDialog properties")
+
+ Layout.fillWidth: true
+
+ GridLayout {
+ columns: 2
+ anchors.fill: parent
+
+ Label {
+ Layout.minimumWidth: ApplicationWindow.window.width * 0.2
+ Layout.maximumWidth: ApplicationWindow.window.width * 0.2
+ text: qsTr("currentFont")
+ }
+ TextField {
+ id: currentFontTextField
+ text: qsTr("AaBbYyZz")
+ font: fontDialog.currentFont
+ readOnly: true
+ selectByMouse: true
+
+ Layout.fillWidth: true
+ }
+
+ Label {
+ text: qsTr("selectedFont")
+ }
+ TextField {
+ id: selectedFontTextField
+ text: qsTr("AaBbYyZz")
+ font: fontDialog.selectedFont
+ readOnly: true
+ selectByMouse: true
+
+ Layout.fillWidth: true
+ }
+
+ Label {
+ text: qsTr("fontOptions")
+
+ Layout.alignment: Qt.AlignTop
+ }
+ ColumnLayout {
+ id: fontOptionsColumnLayout
+
+ CheckBox {
+ id: noButtons
+ text: qsTr("NoButtons")
+
+ readonly property int fontOption: checked ? FontDialog.NoButtons : 0
+ }
+ CheckBox {
+ id: scalableFonts
+ text: qsTr("ScalableFonts")
+
+ readonly property int fontOption: checked ? FontDialog.ScalableFonts : 0
+ }
+ CheckBox {
+ id: nonScalableFonts
+ text: qsTr("NonScalableFonts")
+
+ readonly property int fontOption: checked ? FontDialog.NonScalableFonts : 0
+ }
+ CheckBox {
+ id: monospacedFonts
+ text: qsTr("MonospacedFonts")
+
+ readonly property int fontOption: checked ? FontDialog.MonospacedFonts : 0
+ }
+ CheckBox {
+ id: proportionalFonts
+ text: qsTr("ProportionalFonts")
+
+ readonly property int fontOption: checked ? FontDialog.ProportionalFonts : 0
+ }
+ }
+ }
+ }
+
+ FontDialog {
+ id: fontDialog
+
+ modality: modalityButtonGroup.checkedButton.modality
+ title: titleTextField.text
+ options: noButtons.fontOption
+ | scalableFonts.fontOption
+ | nonScalableFonts.fontOption
+ | monospacedFonts.fontOption
+ | proportionalFonts.fontOption
+ }
+ }
+}
diff --git a/tests/manual/quickcontrols2/dialogs/StringListView.qml b/tests/manual/quickcontrols2/dialogs/StringListView.qml
new file mode 100644
index 0000000000..4a229404fc
--- /dev/null
+++ b/tests/manual/quickcontrols2/dialogs/StringListView.qml
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+
+import "."
+
+ListView {
+ id: root
+ clip: true
+ boundsBehavior: Flickable.StopAtBounds
+
+ Layout.fillWidth: true
+ Layout.preferredHeight: count > 0 ? 128 : noneLabel.implicitHeight
+
+ ScrollBar.vertical: ScrollBar {}
+
+ delegate: TextField {
+ width: root.width
+ text: modelData
+ readOnly: true
+ selectByMouse: true
+ }
+
+ Label {
+ id: noneLabel
+ text: qsTr("(None)")
+ visible: root.count === 0
+ }
+}
diff --git a/tests/manual/quickcontrols2/dialogs/Theme.qml b/tests/manual/quickcontrols2/dialogs/Theme.qml
new file mode 100644
index 0000000000..8114f14eb1
--- /dev/null
+++ b/tests/manual/quickcontrols2/dialogs/Theme.qml
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+pragma Singleton
+
+import QtQml
+
+QtObject {
+ readonly property int toolTipDelay: 1000
+}
diff --git a/tests/manual/quickcontrols2/dialogs/dialogs.cpp b/tests/manual/quickcontrols2/dialogs/dialogs.cpp
new file mode 100644
index 0000000000..8bab70e26d
--- /dev/null
+++ b/tests/manual/quickcontrols2/dialogs/dialogs.cpp
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/qsettings.h>
+#include <QtGui/qguiapplication.h>
+#include <QtQml/qqmlapplicationengine.h>
+#include <QtQuickControls2/qquickstyle.h>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ QCoreApplication::setApplicationName("dialogs-manual-test");
+ QCoreApplication::setOrganizationName("QtProject");
+
+ // Use native dialogs by default unless the user asked us not to.
+ QSettings settings;
+ const QVariant useNativeDialogs = settings.value("useNativeDialogs");
+ if (useNativeDialogs.isValid()) {
+ if (!useNativeDialogs.toBool())
+ QCoreApplication::setAttribute(Qt::AA_DontUseNativeDialogs);
+ } else {
+ // Set the default here so that we can use an alias in QML.
+ // Without this it defaults to CheckBox's checked default value, which is false.
+ settings.setValue("useNativeDialogs", true);
+ }
+
+ QQmlApplicationEngine engine;
+ engine.setInitialProperties({{ "style", QQuickStyle::name() }});
+ engine.load(QUrl(QStringLiteral("qrc:/dialogs.qml")));
+
+ return app.exec();
+}
diff --git a/tests/manual/quickcontrols2/dialogs/dialogs.pro b/tests/manual/quickcontrols2/dialogs/dialogs.pro
new file mode 100644
index 0000000000..7dc1b8fd05
--- /dev/null
+++ b/tests/manual/quickcontrols2/dialogs/dialogs.pro
@@ -0,0 +1,12 @@
+TEMPLATE = app
+TARGET = dialogs
+QT += qml quickcontrols2
+
+SOURCES += dialogs.cpp
+RESOURCES += \
+ dialogs.qml \
+ FileDialogPage.qml \
+ FontDialogPage.qml \
+ StringListView.qml \
+ qmldir \
+ Theme.qml
diff --git a/tests/manual/quickcontrols2/dialogs/dialogs.qml b/tests/manual/quickcontrols2/dialogs/dialogs.qml
new file mode 100644
index 0000000000..6e64659e88
--- /dev/null
+++ b/tests/manual/quickcontrols2/dialogs/dialogs.qml
@@ -0,0 +1,128 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+
+import Qt.labs.settings
+
+ApplicationWindow {
+ id: window
+ width: 800
+ height: 600
+ title: "dialogs - style: " + style
+ visible: true
+
+ required property string style
+
+ Component.onCompleted: {
+ x = Screen.width / 2 - width / 2
+ y = Screen.height / 2 - height / 2
+ }
+
+ Settings {
+ id: settings
+
+ property alias useNativeDialogs: useNativeDialogsCheckBox.checked
+ }
+
+ Page {
+ anchors.fill: parent
+
+ header: TabBar {
+ id: tabBar
+
+ TabButton {
+ text: qsTr("FileDialog")
+ }
+ TabButton {
+ text: qsTr("FontDialog")
+ }
+ }
+
+ ScrollView {
+ id: scrollView
+ anchors.fill: parent
+ clip: true
+
+ StackLayout {
+ id: stackLayout
+ currentIndex: tabBar.currentIndex
+ width: scrollView.width
+
+ FileDialogPage {}
+ FontDialogPage {}
+ }
+ }
+ }
+
+ footer: ToolBar {
+ RowLayout {
+ anchors.fill: parent
+
+ CheckBox {
+ id: useNativeDialogsCheckBox
+ text: qsTr("Use Native Dialogs (requires restart)")
+ checked: settings.useNativeDialogs
+ }
+
+ Item {
+ Layout.fillWidth: true
+ }
+
+ Button {
+ text: qsTr("Open")
+
+ onClicked: stackLayout.children[stackLayout.currentIndex].dialog.open()
+ }
+ }
+ }
+}
diff --git a/tests/manual/quickcontrols2/dialogs/qmldir b/tests/manual/quickcontrols2/dialogs/qmldir
new file mode 100644
index 0000000000..4f4a6b7bf9
--- /dev/null
+++ b/tests/manual/quickcontrols2/dialogs/qmldir
@@ -0,0 +1,3 @@
+module org.qtproject.examples.dialogs
+
+singleton Theme 1.0 Theme.qml