From f45cd1d4394b00d9fc1441bf5535dfb8e0243180 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Sat, 7 Feb 2015 12:24:58 -0800 Subject: [PATCH] Add new Qml Control test window/menu --- src/ui/MainWindow.cc | 20 +++++++++++++++++++- src/ui/MainWindow.h | 5 ++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/ui/MainWindow.cc b/src/ui/MainWindow.cc index d5bc4f960..acddb2bc3 100644 --- a/src/ui/MainWindow.cc +++ b/src/ui/MainWindow.cc @@ -71,6 +71,10 @@ This file is part of the QGROUNDCONTROL project #include "QGCMessageBox.h" #include "QGCDockWidget.h" +#ifdef UNITTEST_BUILD +#include "QmlControls/QmlTestWidget.h" +#endif + #ifdef QGC_OSG_ENABLED #include "Q3DWidgetFactory.h" #endif @@ -186,6 +190,12 @@ MainWindow::MainWindow(QSplashScreen* splashScreen) : #ifdef Q_OS_LINUX menuBar()->setNativeMenuBar(false); #endif + +#ifdef UNITTEST_BUILD + QAction* qmlTestAction = new QAction("Test QML palette and controls", NULL); + connect(qmlTestAction, &QAction::triggered, this, &MainWindow::_showQmlTestWidget); + ui.menuTools->addAction(qmlTestAction); +#endif // Setup UI state machines centerStackActionGroup->setExclusive(true); @@ -338,7 +348,7 @@ MainWindow::MainWindow(QSplashScreen* splashScreen) : connect(&windowNameUpdateTimer, SIGNAL(timeout()), this, SLOT(configureWindowName())); windowNameUpdateTimer.start(15000); emit initStatusChanged(tr("Done"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141)); - + if (!qgcApp()->runningUnitTests()) { show(); } @@ -1519,3 +1529,11 @@ bool MainWindow::x11Event(XEvent *event) return false; } #endif // QGC_MOUSE_ENABLED_LINUX + +#ifdef UNITTEST_BUILD +void MainWindow::_showQmlTestWidget(void) +{ + new QmlTestWidget(); +} +#endif + diff --git a/src/ui/MainWindow.h b/src/ui/MainWindow.h index b10ea3fa2..7ebd2fc34 100644 --- a/src/ui/MainWindow.h +++ b/src/ui/MainWindow.h @@ -294,7 +294,10 @@ private slots: void _showDockWidgetAction(bool show); void _loadCustomWidgetFromFile(void); void _createNewCustomWidget(void); - +#ifdef UNITTEST_BUILD + void _showQmlTestWidget(void); +#endif + private: /// Constructor is private since all creation should be through MainWindow::_create MainWindow(QSplashScreen* splashScreen); -- 2.22.0