@@ -25,6 +25,7 @@
2525#include <QCommandLineParser>
2626#include <QLibrary>
2727#include <libintl.h>
28+#include <QQmlApplicationEngine>
2829
2930#include <paths.h>
3031#include "../qmldebuggerutils.h"
@@ -81,45 +82,43 @@ int main(int argc, const char *argv[])
8182 bindtextdomain("unity8", translationDirectory().toUtf8().data());
8283 textdomain("unity8");
8384
84− QQuickView* view = new QQuickView();
85− view->setResizeMode(QQuickView::SizeRootObjectToView);
85+ #ifdef UNITY8_ENABLE_TOUCH_EMULATION
86+ // You will need this if you want to interact with touch-only components using a mouse
87+ // Needed only when manually testing on a desktop.
88+ MouseTouchAdaptor *mouseTouchAdaptor = 0;
89+ if (parser.isSet(mousetouchOption)) {
90+ mouseTouchAdaptor = MouseTouchAdaptor::instance();
91+ }
92+ #endif
8693
94+ QQmlApplicationEngine engine;
95+
96+ int initialWidth = -1;
97+ int initialHeight = -1;
8798 if (parser.isSet(windowGeometryOption) &&
8899 parser.value(windowGeometryOption).split('x').size() == 2)
89100 {
90101 QStringList geom = parser.value(windowGeometryOption).split('x');
91102 QSize windowSize(geom.at(0).toInt(), geom.at(1).toInt());
92103 if (windowSize.isValid()) {
93− view->setWidth(windowSize.width());
94− view->setHeight(windowSize.height());
104+ initialWidth = windowSize.width();
105+ initialHeight = windowSize.height();
95106 }
96107 }
97−
98− view->setTitle(QStringLiteral("Scopes"));
99−
100− #ifdef UNITY8_ENABLE_TOUCH_EMULATION
101− // You will need this if you want to interact with touch-only components using a mouse
102− // Needed only when manually testing on a desktop.
103− MouseTouchAdaptor *mouseTouchAdaptor = 0;
104− if (parser.isSet(mousetouchOption)) {
105− mouseTouchAdaptor = MouseTouchAdaptor::instance();
106− }
107− #endif
108+ engine.rootContext()->setContextProperty("initialWidth", initialWidth);
109+ engine.rootContext()->setContextProperty("initialHeight", initialHeight);
108110
109111 QUrl source(::qmlDirectory() + "/Dash/DashApplication.qml");
110− prependImportPaths(view->engine(), ::overrideImportPaths());
111− appendImportPaths(view->engine(), ::fallbackImportPaths());
112+ prependImportPaths(&engine, ::overrideImportPaths());
113+ appendImportPaths(&engine, ::fallbackImportPaths());
112114
113115 CachingNetworkManagerFactory *managerFactory = new CachingNetworkManagerFactory();
114− view->engine()->setNetworkAccessManagerFactory(managerFactory);
116+ engine.setNetworkAccessManagerFactory(managerFactory);
115117
116− view->setSource(source);
117− view->show();
118+ engine.load(source);
118119
119120 int result = application->exec();
120121
121− delete view;
122−
123122 #ifdef UNITY8_ENABLE_TOUCH_EMULATION
124123 delete mouseTouchAdaptor;
125124 #endif