diff options
Diffstat (limited to 'tests/manual/quickcontrols')
18 files changed, 102 insertions, 227 deletions
diff --git a/tests/manual/quickcontrols/testbench/+Imagine/ApplicationWindow.qml b/tests/manual/quickcontrols/testbench/+Imagine/MainWindow.qml index 45c3e39a23..45c3e39a23 100644 --- a/tests/manual/quickcontrols/testbench/+Imagine/ApplicationWindow.qml +++ b/tests/manual/quickcontrols/testbench/+Imagine/MainWindow.qml diff --git a/tests/manual/quickcontrols/testbench/+Imagine/Dialog.qml b/tests/manual/quickcontrols/testbench/+Imagine/TestbenchDialog.qml index 3f8a131c12..3f8a131c12 100644 --- a/tests/manual/quickcontrols/testbench/+Imagine/Dialog.qml +++ b/tests/manual/quickcontrols/testbench/+Imagine/TestbenchDialog.qml diff --git a/tests/manual/quickcontrols/testbench/+Imagine/Menu.qml b/tests/manual/quickcontrols/testbench/+Imagine/TestbenchMenu.qml index 6614977ce6..6614977ce6 100644 --- a/tests/manual/quickcontrols/testbench/+Imagine/Menu.qml +++ b/tests/manual/quickcontrols/testbench/+Imagine/TestbenchMenu.qml diff --git a/tests/manual/quickcontrols/testbench/+Imagine/ToolBar.qml b/tests/manual/quickcontrols/testbench/+Imagine/TestbenchToolBar.qml index 77a39f063d..77a39f063d 100644 --- a/tests/manual/quickcontrols/testbench/+Imagine/ToolBar.qml +++ b/tests/manual/quickcontrols/testbench/+Imagine/TestbenchToolBar.qml diff --git a/tests/manual/quickcontrols/testbench/CMakeLists.txt b/tests/manual/quickcontrols/testbench/CMakeLists.txt index 600108d5fa..460e86abf4 100644 --- a/tests/manual/quickcontrols/testbench/CMakeLists.txt +++ b/tests/manual/quickcontrols/testbench/CMakeLists.txt @@ -1,121 +1,92 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: BSD-3-Clause -# Generated from testbench.pro. - if (NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) cmake_minimum_required(VERSION 3.16) project(testbench LANGUAGES C CXX) find_package(Qt6BuildInternals COMPONENTS STANDALONE_TEST) endif() -##################################################################### -## testbench Binary: -##################################################################### +find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick QuickControls2) -qt_internal_add_manual_test(testbench - GUI - SOURCES - assetfixer.cpp assetfixer.h - clipboard.cpp clipboard.h - directoryvalidator.cpp directoryvalidator.h - main.cpp - LIBRARIES - Qt::CorePrivate - Qt::Gui - Qt::Qml - Qt::Quick - Qt::QuickControls2 - Qt::QuickControls2Private -) +qt_standard_project_setup(REQUIRES 6.8) -# Resources: -set(qml_resource_files - "+Imagine/ApplicationWindow.qml" - "+Imagine/ContentPane.qml" - "+Imagine/Dialog.qml" - "+Imagine/Menu.qml" - "+Imagine/ToolBar.qml" - "ApplicationWindow.qml" - "ColorEditor.qml" - "ContentPane.qml" - "ControlContainer.qml" - "Dialog.qml" - "ExampleContainer.qml" - "Menu.qml" - "SettingsDialog.qml" - "ToolBar.qml" - "controls/BusyIndicator.qml" - "controls/Button.qml" - "controls/CheckBox.qml" - "controls/CheckDelegate.qml" - "controls/ComboBox.qml" - "controls/DelayButton.qml" - "controls/Dial.qml" - "controls/Dialog.qml" - "controls/Frame.qml" - "controls/GroupBox.qml" - "controls/ItemDelegate.qml" - "controls/Label.qml" - "controls/Menu.qml" - "controls/MenuBar.qml" - "controls/Page.qml" - "controls/PageIndicator.qml" - "controls/Pane.qml" - "controls/ProgressBar.qml" - "controls/RadioButton.qml" - "controls/RadioDelegate.qml" - "controls/RangeSlider.qml" - "controls/RoundButton.qml" - "controls/ScrollBar.qml" - "controls/ScrollIndicator.qml" - "controls/SearchField.qml" - "controls/Slider.qml" - "controls/SpinBox.qml" - "controls/SplitView.qml" - "controls/SwipeDelegate.qml" - "controls/Switch.qml" - "controls/SwitchDelegate.qml" - "controls/TabBar.qml" - "controls/TextArea.qml" - "controls/TextField.qml" - "controls/ToolBar.qml" - "controls/ToolTip.qml" - "controls/Tumbler.qml" - "qtquickcontrols2.conf" - "testbench.qml" +qt_add_executable(testbench + main.cpp ) -qt_internal_add_resource(testbench "qml" - PREFIX - "/" - FILES - ${qml_resource_files} -) -set(fonts_resource_files - "fonts/fontello.ttf" +qt_add_qml_module(testbench + URI Testbench + SOURCES + assetfixer.cpp + assetfixer.h + clipboard.cpp + clipboard.h + directoryvalidator.cpp + directoryvalidator.h + QML_FILES + "+Imagine/ContentPane.qml" + "+Imagine/MainWindow.qml" + "+Imagine/TestbenchDialog.qml" + "+Imagine/TestbenchMenu.qml" + "+Imagine/TestbenchToolBar.qml" + "ColorEditor.qml" + "ContentPane.qml" + "ControlContainer.qml" + "ExampleContainer.qml" + "Main.qml" + "MainWindow.qml" + "SettingsDialog.qml" + "TestbenchDialog.qml" + "TestbenchMenu.qml" + "TestbenchToolBar.qml" + "controls/BusyIndicator.qml" + "controls/Button.qml" + "controls/CheckBox.qml" + "controls/CheckDelegate.qml" + "controls/ComboBox.qml" + "controls/DelayButton.qml" + "controls/Dial.qml" + "controls/Dialog.qml" + "controls/Frame.qml" + "controls/GroupBox.qml" + "controls/ItemDelegate.qml" + "controls/Label.qml" + "controls/Menu.qml" + "controls/MenuBar.qml" + "controls/Page.qml" + "controls/PageIndicator.qml" + "controls/Pane.qml" + "controls/ProgressBar.qml" + "controls/RadioButton.qml" + "controls/RadioDelegate.qml" + "controls/RangeSlider.qml" + "controls/RoundButton.qml" + "controls/ScrollBar.qml" + "controls/ScrollIndicator.qml" + "controls/SearchField.qml" + "controls/Slider.qml" + "controls/SpinBox.qml" + "controls/SplitView.qml" + "controls/SwipeDelegate.qml" + "controls/Switch.qml" + "controls/SwitchDelegate.qml" + "controls/TabBar.qml" + "controls/TextArea.qml" + "controls/TextField.qml" + "controls/ToolBar.qml" + "controls/ToolTip.qml" + "controls/Tumbler.qml" + RESOURCES + "qtquickcontrols2.conf" + "fonts/fontello.ttf" ) -qt_internal_add_resource(testbench "fonts" - PREFIX - "/" - FILES - ${fonts_resource_files} +target_link_libraries(testbench PUBLIC + Qt::CorePrivate + Qt::Gui + Qt::Qml + Qt::Quick + Qt::QuickControls2 + Qt::QuickControls2Private ) - - -#### Keys ignored in scope 1:.:.:testbench.pro:<TRUE>: -# QML_IMPORT_PATH = <EMPTY> -# TEMPLATE = "app" - -## Scopes: -##################################################################### - -#### Keys ignored in scope 3:.:.:deployment.pri:UNIX AND NOT ANDROID: -# INSTALLS = "target" - -#### Keys ignored in scope 5:.:.:deployment.pri:QNX: -# target.path = "/tmp/$${TARGET}/bin" - -#### Keys ignored in scope 6:.:.:deployment.pri:else: -# target.path = "/opt/$${TARGET}/bin" diff --git a/tests/manual/quickcontrols/testbench/testbench.qml b/tests/manual/quickcontrols/testbench/Main.qml index 68975cfd69..7507d290a5 100644 --- a/tests/manual/quickcontrols/testbench/testbench.qml +++ b/tests/manual/quickcontrols/testbench/Main.qml @@ -8,10 +8,9 @@ import QtQuick.Layouts import QtQuick.Controls import Qt.labs.folderlistmodel -import Backend -import "." as Ui +import Testbench as Testbench -Ui.ApplicationWindow { +MainWindow { id: window visible: true width: 1000 @@ -115,7 +114,7 @@ Ui.ApplicationWindow { property string link } - header: Ui.ToolBar { + header: TestbenchToolBar { RowLayout { anchors.fill: parent @@ -167,7 +166,7 @@ Ui.ApplicationWindow { onClicked: optionsMenu.open() - Ui.Menu { + TestbenchMenu { id: optionsMenu x: 1 y: 1 + parent.height @@ -349,7 +348,7 @@ Ui.ApplicationWindow { return props; } - Ui.ContentPane { + ContentPane { id: contentPane anchors.fill: parent @@ -377,9 +376,9 @@ Ui.ApplicationWindow { FolderListModel { id: controlFolderListModel - folder: "qrc:/controls" + folder: "qrc:/qt/qml/Testbench/controls" showDirs: false - nameFilters: searchTextField.text.length > 0 ? ["*" + searchTextField.text + "*.qml"] : [] + nameFilters: searchTextField.text.length > 0 ? ["*" + searchTextField.text + "*.qml"] : ["*.qml"] caseSensitive: false } diff --git a/tests/manual/quickcontrols/testbench/ApplicationWindow.qml b/tests/manual/quickcontrols/testbench/MainWindow.qml index 57baed7127..57baed7127 100644 --- a/tests/manual/quickcontrols/testbench/ApplicationWindow.qml +++ b/tests/manual/quickcontrols/testbench/MainWindow.qml diff --git a/tests/manual/quickcontrols/testbench/SettingsDialog.qml b/tests/manual/quickcontrols/testbench/SettingsDialog.qml index 545cf6fa83..34d8e9c25a 100644 --- a/tests/manual/quickcontrols/testbench/SettingsDialog.qml +++ b/tests/manual/quickcontrols/testbench/SettingsDialog.qml @@ -5,10 +5,9 @@ import QtQuick import QtQuick.Controls import QtQuick.Layouts -import Backend -import "." as Ui +import Testbench as Testbench -Ui.Dialog { +TestbenchDialog { id: settingsDialog title: "Settings" width: 500 @@ -98,11 +97,11 @@ Ui.Dialog { return map; } - Clipboard { + Testbench.Clipboard { id: clipboard } - DirectoryValidator { + Testbench.DirectoryValidator { id: directoryValidator path: imaginePathTextField.text } diff --git a/tests/manual/quickcontrols/testbench/Dialog.qml b/tests/manual/quickcontrols/testbench/TestbenchDialog.qml index f909386c86..f909386c86 100644 --- a/tests/manual/quickcontrols/testbench/Dialog.qml +++ b/tests/manual/quickcontrols/testbench/TestbenchDialog.qml diff --git a/tests/manual/quickcontrols/testbench/Menu.qml b/tests/manual/quickcontrols/testbench/TestbenchMenu.qml index 8f39739aaa..8f39739aaa 100644 --- a/tests/manual/quickcontrols/testbench/Menu.qml +++ b/tests/manual/quickcontrols/testbench/TestbenchMenu.qml diff --git a/tests/manual/quickcontrols/testbench/ToolBar.qml b/tests/manual/quickcontrols/testbench/TestbenchToolBar.qml index 1d7c503f56..1d7c503f56 100644 --- a/tests/manual/quickcontrols/testbench/ToolBar.qml +++ b/tests/manual/quickcontrols/testbench/TestbenchToolBar.qml diff --git a/tests/manual/quickcontrols/testbench/assetfixer.h b/tests/manual/quickcontrols/testbench/assetfixer.h index 1651ffad26..e883706e63 100644 --- a/tests/manual/quickcontrols/testbench/assetfixer.h +++ b/tests/manual/quickcontrols/testbench/assetfixer.h @@ -9,6 +9,7 @@ #include <QFileSystemWatcher> #include <QQmlParserStatus> #include <QUrl> +#include <QtQmlIntegration/qqmlintegration.h> class AssetFixer : public QObject, public QQmlParserStatus { @@ -20,6 +21,7 @@ class AssetFixer : public QObject, public QQmlParserStatus Q_PROPERTY(QDateTime assetDirectoryLastModified READ assetDirectoryLastModified WRITE setAssetDirectoryLastModified NOTIFY assetDirectoryLastModifiedChanged FINAL) Q_INTERFACES(QQmlParserStatus) + QML_ELEMENT public: explicit AssetFixer(QObject *parent = nullptr); diff --git a/tests/manual/quickcontrols/testbench/clipboard.h b/tests/manual/quickcontrols/testbench/clipboard.h index c56103b84c..6590c0de0a 100644 --- a/tests/manual/quickcontrols/testbench/clipboard.h +++ b/tests/manual/quickcontrols/testbench/clipboard.h @@ -7,19 +7,19 @@ #include <QObject> #include <QJSValue> #include <QVariant> +#include <QtQmlIntegration/qqmlintegration.h> class Clipboard : public QObject { Q_OBJECT + QML_ELEMENT + public: explicit Clipboard(QObject *parent = nullptr); public slots: void copy(const QJSValue &keyValueMap); QVariant paste() const; - -// void copyPaletteSettingsToClipboard(); -// void importPaletteSettingsFromClipboard(); }; #endif // CLIPBOARD_H diff --git a/tests/manual/quickcontrols/testbench/deployment.pri b/tests/manual/quickcontrols/testbench/deployment.pri deleted file mode 100644 index c89af25a85..0000000000 --- a/tests/manual/quickcontrols/testbench/deployment.pri +++ /dev/null @@ -1,14 +0,0 @@ -unix:!android { - isEmpty(target.path) { - qnx { - target.path = /tmp/$${TARGET}/bin - } else { - target.path = /opt/$${TARGET}/bin - } - export(target.path) - } - INSTALLS += target -} - -export(INSTALLS) - diff --git a/tests/manual/quickcontrols/testbench/directoryvalidator.h b/tests/manual/quickcontrols/testbench/directoryvalidator.h index b411662281..eab76a396a 100644 --- a/tests/manual/quickcontrols/testbench/directoryvalidator.h +++ b/tests/manual/quickcontrols/testbench/directoryvalidator.h @@ -5,6 +5,7 @@ #define DIRECTORYVALIDATOR_H #include <QObject> +#include <QtQmlIntegration/qqmlintegration.h> class DirectoryValidator : public QObject { @@ -12,6 +13,7 @@ class DirectoryValidator : public QObject Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged FINAL) Q_PROPERTY(bool valid READ isValid NOTIFY validChanged FINAL) Q_PROPERTY(QString errorMessage READ errorMessage NOTIFY errorMessageChanged FINAL) + QML_ELEMENT public: explicit DirectoryValidator(QObject *parent = nullptr); diff --git a/tests/manual/quickcontrols/testbench/main.cpp b/tests/manual/quickcontrols/testbench/main.cpp index f0ae272cd9..876ee382a2 100644 --- a/tests/manual/quickcontrols/testbench/main.cpp +++ b/tests/manual/quickcontrols/testbench/main.cpp @@ -10,10 +10,6 @@ #include <QQuickStyle> #include <QtQuickControls2/private/qquickstyle_p.h> -#include "assetfixer.h" -#include "clipboard.h" -#include "directoryvalidator.h" - int main(int argc, char *argv[]) { QGuiApplication::setApplicationName("testbench"); @@ -30,19 +26,18 @@ int main(int argc, char *argv[]) else QQuickStyle::setStyle(settings.value("style").isValid() ? settings.value("style").toString() : "Imagine"); - if (QFontDatabase::addApplicationFont(":/fonts/fontello.ttf") == -1) { + if (QFontDatabase::addApplicationFont(":qt/qml/Testbench/fonts/fontello.ttf") == -1) qWarning() << "Failed to load fontawesome font"; - } QQmlApplicationEngine engine; - - qmlRegisterType<AssetFixer>("Backend", 1, 0, "AssetFixer"); - qmlRegisterType<Clipboard>("Backend", 1, 0, "Clipboard"); - qmlRegisterType<DirectoryValidator>("Backend", 1, 0, "DirectoryValidator"); - + QObject::connect( + &engine, + &QQmlApplicationEngine::objectCreationFailed, + &app, + []() { QCoreApplication::exit(-1); }, + Qt::QueuedConnection); engine.rootContext()->setContextProperty("availableStyles", QQuickStylePrivate::builtInStyles()); - - engine.load(QUrl(QStringLiteral("qrc:/testbench.qml"))); + engine.loadFromModule("Testbench", "Main"); return app.exec(); } diff --git a/tests/manual/quickcontrols/testbench/qml.qrc b/tests/manual/quickcontrols/testbench/qml.qrc deleted file mode 100644 index 82e69be6f3..0000000000 --- a/tests/manual/quickcontrols/testbench/qml.qrc +++ /dev/null @@ -1,55 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>ControlContainer.qml</file> - <file>controls/Button.qml</file> - <file>controls/CheckBox.qml</file> - <file>controls/RadioButton.qml</file> - <file>controls/CheckDelegate.qml</file> - <file>controls/ComboBox.qml</file> - <file>controls/DelayButton.qml</file> - <file>controls/Dial.qml</file> - <file>controls/Frame.qml</file> - <file>controls/GroupBox.qml</file> - <file>controls/ItemDelegate.qml</file> - <file>controls/Page.qml</file> - <file>controls/PageIndicator.qml</file> - <file>controls/Pane.qml</file> - <file>controls/ProgressBar.qml</file> - <file>controls/RadioDelegate.qml</file> - <file>controls/RangeSlider.qml</file> - <file>controls/RoundButton.qml</file> - <file>controls/ScrollBar.qml</file> - <file>controls/ScrollIndicator.qml</file> - <file>controls/Slider.qml</file> - <file>controls/SpinBox.qml</file> - <file>controls/SwipeDelegate.qml</file> - <file>controls/Switch.qml</file> - <file>controls/SwitchDelegate.qml</file> - <file>controls/TabBar.qml</file> - <file>controls/TextArea.qml</file> - <file>controls/TextField.qml</file> - <file>SettingsDialog.qml</file> - <file>ColorEditor.qml</file> - <file>controls/ToolBar.qml</file> - <file>controls/Dialog.qml</file> - <file>controls/Menu.qml</file> - <file>ExampleContainer.qml</file> - <file>controls/Label.qml</file> - <file>controls/ToolTip.qml</file> - <file>controls/Tumbler.qml</file> - <file>controls/BusyIndicator.qml</file> - <file>testbench.qml</file> - <file>controls/MenuBar.qml</file> - <file>controls/SplitView.qml</file> - <file>+Imagine/ApplicationWindow.qml</file> - <file>ApplicationWindow.qml</file> - <file>+Imagine/ToolBar.qml</file> - <file>ToolBar.qml</file> - <file>+Imagine/Menu.qml</file> - <file>Menu.qml</file> - <file>+Imagine/Dialog.qml</file> - <file>Dialog.qml</file> - <file>ContentPane.qml</file> - <file>+Imagine/ContentPane.qml</file> - </qresource> -</RCC> diff --git a/tests/manual/quickcontrols/testbench/testbench.pro b/tests/manual/quickcontrols/testbench/testbench.pro deleted file mode 100644 index 4509f4967d..0000000000 --- a/tests/manual/quickcontrols/testbench/testbench.pro +++ /dev/null @@ -1,24 +0,0 @@ -TEMPLATE = app - -QT += qml quick quickcontrols2 quickcontrols2-private -CONFIG += c++11 - -HEADERS += \ - assetfixer.h \ - directoryvalidator.h \ - clipboard.h - -SOURCES += main.cpp \ - assetfixer.cpp \ - directoryvalidator.cpp \ - clipboard.cpp - -RESOURCES += qml.qrc \ - fonts.qrc - -# Additional import path used to resolve QML modules in Qt Creator's code model -QML_IMPORT_PATH = - -# Default rules for deployment. -include(deployment.pri) - |
