diff options
Diffstat (limited to 'tests/manual/quickcontrols/qquickdialog')
8 files changed, 327 insertions, 0 deletions
diff --git a/tests/manual/quickcontrols/qquickdialog/CMakeLists.txt b/tests/manual/quickcontrols/qquickdialog/CMakeLists.txt new file mode 100644 index 0000000000..232dae7ffa --- /dev/null +++ b/tests/manual/quickcontrols/qquickdialog/CMakeLists.txt @@ -0,0 +1,34 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +if (NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(qquickdialog LANGUAGES C CXX ASM) + find_package(Qt6BuildInternals COMPONENTS STANDALONE_TEST) +endif() + +qt_internal_add_manual_test(qquickdialog + GUI + SOURCES + qquickdialog.cpp + LIBRARIES + Qt::Gui + Qt::Qml + Qt::QuickControls2 +) + +# Resources: +set(qmake_immediate_resource_files + "CustomDialog.qml" + "DialogLabel.qml" + "Marker.qml" + "qquickdialog.qml" + "qtquickcontrols2.conf" +) + +qt_internal_add_resource(qquickdialog "qmake_immediate" + PREFIX + "/" + FILES + ${qmake_immediate_resource_files} +) diff --git a/tests/manual/quickcontrols/qquickdialog/CustomDialog.qml b/tests/manual/quickcontrols/qquickdialog/CustomDialog.qml new file mode 100644 index 0000000000..c54b58603b --- /dev/null +++ b/tests/manual/quickcontrols/qquickdialog/CustomDialog.qml @@ -0,0 +1,27 @@ +// Copyright (C) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick.Controls + +Dialog { + id: root + x: previousDialog ? previousDialog.x + previousDialog.width + space : 0 + y: previousDialog ? previousDialog.y : 0 + closePolicy: Dialog.NoAutoClose + visible: true + + property Dialog previousDialog + property int space: dialogSpacing + + Marker { + parent: root.footer.contentItem + visible: visualizeDialogButtonBoxContentItem + text: "footer.contentItem" + } + Marker { + parent: root.footer + visible: visualizeDialogButtonBox + text: "footer" + border.color: "red" + } +} diff --git a/tests/manual/quickcontrols/qquickdialog/DialogLabel.qml b/tests/manual/quickcontrols/qquickdialog/DialogLabel.qml new file mode 100644 index 0000000000..273eaf162d --- /dev/null +++ b/tests/manual/quickcontrols/qquickdialog/DialogLabel.qml @@ -0,0 +1,13 @@ +// Copyright (C) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick.Controls + +Label { + x: dialog.x + (dialog.width - width) / 2 + y: dialog.y - height + width: dialog.width + wrapMode: Label.Wrap + + property Dialog dialog +} diff --git a/tests/manual/quickcontrols/qquickdialog/Marker.qml b/tests/manual/quickcontrols/qquickdialog/Marker.qml new file mode 100644 index 0000000000..42f9c2d93b --- /dev/null +++ b/tests/manual/quickcontrols/qquickdialog/Marker.qml @@ -0,0 +1,21 @@ +// Copyright (C) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick + +Rectangle { + anchors.fill: parent + color: "transparent" + border.color: "darkorange" + + property alias text: label.text + + Text { + id: label + font.pixelSize: Qt.application.font.pixelSize * 0.6 + color: parent.border.color + anchors.left: parent.left + anchors.bottom: parent.bottom + anchors.margins: 4 + } +} diff --git a/tests/manual/quickcontrols/qquickdialog/qquickdialog.cpp b/tests/manual/quickcontrols/qquickdialog/qquickdialog.cpp new file mode 100644 index 0000000000..92c060e6c4 --- /dev/null +++ b/tests/manual/quickcontrols/qquickdialog/qquickdialog.cpp @@ -0,0 +1,15 @@ +// Copyright (C) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +#include <QGuiApplication> +#include <QQmlApplicationEngine> + +int main(int argc, char *argv[]) +{ + QGuiApplication app(argc, argv); + + QQmlApplicationEngine engine; + engine.load(QUrl("qrc:/qquickdialog.qml")); + + return app.exec(); +} diff --git a/tests/manual/quickcontrols/qquickdialog/qquickdialog.pro b/tests/manual/quickcontrols/qquickdialog/qquickdialog.pro new file mode 100644 index 0000000000..aee7655b65 --- /dev/null +++ b/tests/manual/quickcontrols/qquickdialog/qquickdialog.pro @@ -0,0 +1,11 @@ +TEMPLATE = app +TARGET = qquickdialog +QT += qml quickcontrols2 + +SOURCES += qquickdialog.cpp +RESOURCES += \ + qtquickcontrols2.conf \ + qquickdialog.qml \ + Marker.qml \ + CustomDialog.qml \ + DialogLabel.qml diff --git a/tests/manual/quickcontrols/qquickdialog/qquickdialog.qml b/tests/manual/quickcontrols/qquickdialog/qquickdialog.qml new file mode 100644 index 0000000000..2afa0898e8 --- /dev/null +++ b/tests/manual/quickcontrols/qquickdialog/qquickdialog.qml @@ -0,0 +1,200 @@ +// Copyright (C) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +ApplicationWindow { + id: window + width: 1200 + height: 800 + title: "qquickdialog" + visible: true + + property alias visualizeDialogButtonBoxContentItem: visualizeDialogButtonBoxContentItemMenuItem.checked + property alias visualizeDialogButtonBox: visualizeDialogButtonBoxMenuItem.checked + + property int dialogSpacing: 60 + + header: ToolBar { + RowLayout { + anchors.fill: parent + Item { + Layout.fillWidth: true + } + + ToolButton { + text: "Settings" + onClicked: settingsMenu.open() + + Menu { + id: settingsMenu + width: 400 + + MenuItem { + id: visualizeDialogButtonBoxContentItemMenuItem + text: "Visualize DialogButtonBox contentItem" + checkable: true + } + + MenuItem { + id: visualizeDialogButtonBoxMenuItem + text: "Visualize DialogButtonBox" + checkable: true + } + } + } + } + } + + + DialogLabel { + text: "implicit width" + dialog: dialogImplicitWidthNoButtons + width: 100 + } + CustomDialog { + id: dialogImplicitWidthNoButtons + x: dialogSpacing + y: dialogSpacing + space: 200 + } + + DialogLabel { + text: "title, implicit width" + dialog: dialogImplicitWidthTitleNoButtons + width: 150 + } + CustomDialog { + id: dialogImplicitWidthTitleNoButtons + y: dialogSpacing + title: "Test" + previousDialog: dialogImplicitWidthNoButtons + space: 200 + } + + DialogLabel { + text: "title, fixed width" + dialog: dialogFixedWidthTitleNoButtons + } + CustomDialog { + id: dialogFixedWidthTitleNoButtons + y: dialogSpacing + width: 300 + title: "Test" + previousDialog: dialogImplicitWidthTitleNoButtons + space: 200 + } + + + DialogLabel { + text: "one standard button, implicit width" + dialog: dialogImplicitWidthOneButton + } + CustomDialog { + id: dialogImplicitWidthOneButton + x: dialogSpacing + y: dialogFixedWidthTitleNoButtons.y + dialogFixedWidthTitleNoButtons.height + dialogSpacing + standardButtons: Dialog.Ok + } + + DialogLabel { + text: "two standard buttons, implicit width" + dialog: dialogImplicitWidthTwoButtons + } + CustomDialog { + id: dialogImplicitWidthTwoButtons + standardButtons: Dialog.Ok | Dialog.Cancel + previousDialog: dialogImplicitWidthOneButton + } + + DialogLabel { + text: "three standard buttons, implicit width" + dialog: dialogImplicitWidthThreeButtons + } + CustomDialog { + id: dialogImplicitWidthThreeButtons + standardButtons: Dialog.Apply | Dialog.RestoreDefaults | Dialog.Cancel + previousDialog: dialogImplicitWidthTwoButtons + } + + + DialogLabel { + text: "text, one standard button, implicit width" + dialog: dialogTextImplicitWidthOneButton + } + CustomDialog { + id: dialogTextImplicitWidthOneButton + x: dialogSpacing + y: dialogImplicitWidthThreeButtons.y + dialogImplicitWidthThreeButtons.height + dialogSpacing + standardButtons: Dialog.Ok + + Label { + text: "A Label" + } + } + + DialogLabel { + text: "text, two standard buttons, implicit width" + dialog: dialogTextImplicitWidthTwoButtons + } + CustomDialog { + id: dialogTextImplicitWidthTwoButtons + standardButtons: Dialog.Ok | Dialog.Cancel + previousDialog: dialogTextImplicitWidthOneButton + + Label { + text: "A Label" + } + } + + DialogLabel { + text: "text, three standard buttons, implicit width" + dialog: dialogTextImplicitWidthThreeButtons + } + CustomDialog { + id: dialogTextImplicitWidthThreeButtons + standardButtons: Dialog.Apply | Dialog.RestoreDefaults | Dialog.Cancel + previousDialog: dialogTextImplicitWidthTwoButtons + + Label { + text: "A Label" + } + } + + + DialogLabel { + text: "one standard button, fixed width (300)" + dialog: dialogFixedWidthOneButton + } + CustomDialog { + id: dialogFixedWidthOneButton + x: dialogSpacing + y: dialogTextImplicitWidthThreeButtons.y + dialogTextImplicitWidthThreeButtons.height + dialogSpacing + width: 300 + standardButtons: Dialog.Ok + } + + DialogLabel { + text: "two standard buttons, fixed width (300)" + dialog: dialogFixedWidthTwoButtons + } + CustomDialog { + id: dialogFixedWidthTwoButtons + width: 300 + standardButtons: Dialog.Ok | Dialog.Cancel + previousDialog: dialogFixedWidthOneButton + } + + DialogLabel { + text: "three standard buttons, fixed width (300)" + dialog: dialogFixedWidthThreeButtons + } + CustomDialog { + id: dialogFixedWidthThreeButtons + width: 300 + standardButtons: Dialog.Apply | Dialog.RestoreDefaults | Dialog.Cancel + previousDialog: dialogFixedWidthTwoButtons + } +} diff --git a/tests/manual/quickcontrols/qquickdialog/qtquickcontrols2.conf b/tests/manual/quickcontrols/qquickdialog/qtquickcontrols2.conf new file mode 100644 index 0000000000..53f380bfc9 --- /dev/null +++ b/tests/manual/quickcontrols/qquickdialog/qtquickcontrols2.conf @@ -0,0 +1,6 @@ +[Controls] +Style=Basic +;Style=Fusion +;Style=Imagine +;Style=Material +;Style=Universal |