Move Platform::createMainWindow() to dev mode
This is for tests only
This commit is contained in:
@@ -12,6 +12,8 @@
|
||||
#include "KDDockWidgets.h"
|
||||
#include "Platform_qtquick.h"
|
||||
#include "views/View_qtquick.h"
|
||||
#include "qtquick/views/MainWindow_qtquick.h"
|
||||
#include "controllers/MainWindow.h"
|
||||
|
||||
#include <QApplication> // TODO: Make it QGuiApplication
|
||||
#include <QQmlEngine>
|
||||
@@ -101,4 +103,31 @@ View *Platform_qtquick::tests_createNonClosableView(View *parent)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Controllers::MainWindow *Platform_qtquick::createMainWindow(const QString &uniqueName,
|
||||
CreateViewOptions viewOpts,
|
||||
MainWindowOptions options,
|
||||
View *parent, Qt::WindowFlags flags) const
|
||||
{
|
||||
QQuickItem *parentItem = Views::asQQuickItem(parent);
|
||||
|
||||
if (!parentItem) {
|
||||
auto view = new QQuickView(m_qmlEngine, nullptr);
|
||||
view->resize(viewOpts.size);
|
||||
|
||||
view->setResizeMode(QQuickView::SizeRootObjectToView);
|
||||
view->setSource(QUrl(QStringLiteral("qrc:/main.qml")));
|
||||
|
||||
if (viewOpts.isVisible)
|
||||
view->show();
|
||||
|
||||
parentItem = view->rootObject();
|
||||
Platform::instance()->tests_wait(100); // the root object gets sized delayed
|
||||
}
|
||||
|
||||
auto view = new Views::MainWindow_qtquick(uniqueName, options,
|
||||
parentItem, flags);
|
||||
|
||||
return view->mainWindow();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user