diff options
| author | Mitch Curtis <mitch.curtis@qt.io> | 2025-11-07 15:35:42 +0800 |
|---|---|---|
| committer | Mitch Curtis <mitch.curtis@qt.io> | 2025-11-11 09:20:36 +0800 |
| commit | dd31db74a3e8d741fce5b64e5f9223d162534b1a (patch) | |
| tree | a9a36feb0d36f7c3e17db8058abbbd05c5752ba5 /tests/manual/quickcontrols/testbench/main.cpp | |
| parent | bc3c9c4607c80ba99510973300ddc2133fcf33a5 (diff) | |
testbench: convert to declarative type registration
Also remove unused qmake files.
Pick-to: 6.8 6.10
Change-Id: I3a29e1b40361d852b4a87c748e8838b99fbd8805
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Diffstat (limited to 'tests/manual/quickcontrols/testbench/main.cpp')
| -rw-r--r-- | tests/manual/quickcontrols/testbench/main.cpp | 21 |
1 files changed, 8 insertions, 13 deletions
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(); } |
