@@ -25,6 +25,7 @@
25#include <QCommandLineParser>
25#include <QCommandLineParser>
26#include <QLibrary>
26#include <QLibrary>
27#include <libintl.h>
27#include <libintl.h>
28+#include <QQmlApplicationEngine>
29#include <paths.h>
30#include <paths.h>
30#include "../qmldebuggerutils.h"
31#include "../qmldebuggerutils.h"
@@ -81,45 +82,43 @@ int main(int argc, const char *argv[])
81 bindtextdomain("unity8", translationDirectory().toUtf8().data());
82 bindtextdomain("unity8", translationDirectory().toUtf8().data());
82 textdomain("unity8");
83 textdomain("unity8");
84− QQuickView* view = new QQuickView();
85+ #ifdef UNITY8_ENABLE_TOUCH_EMULATION
85− view->setResizeMode(QQuickView::SizeRootObjectToView);
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();
94+ QQmlApplicationEngine engine;
96+ int initialWidth = -1;
97+ int initialHeight = -1;
87 if (parser.isSet(windowGeometryOption) &&
98 if (parser.isSet(windowGeometryOption) &&
88 parser.value(windowGeometryOption).split('x').size() == 2)
99 parser.value(windowGeometryOption).split('x').size() == 2)
90 QStringList geom = parser.value(windowGeometryOption).split('x');
101 QStringList geom = parser.value(windowGeometryOption).split('x');
91 QSize windowSize(geom.at(0).toInt(), geom.at(1).toInt());
102 QSize windowSize(geom.at(0).toInt(), geom.at(1).toInt());
92 if (windowSize.isValid()) {
103 if (windowSize.isValid()) {
93− view->setWidth(windowSize.width());
104+ initialWidth = windowSize.width();
94− view->setHeight(windowSize.height());
105+ initialHeight = windowSize.height();
97−
108+ engine.rootContext()->setContextProperty("initialWidth", initialWidth);
98− view->setTitle(QStringLiteral("Scopes"));
109+ engine.rootContext()->setContextProperty("initialHeight", initialHeight);
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();
109 QUrl source(::qmlDirectory() + "/Dash/DashApplication.qml");
111 QUrl source(::qmlDirectory() + "/Dash/DashApplication.qml");
110− prependImportPaths(view->engine(), ::overrideImportPaths());
112+ prependImportPaths(&engine, ::overrideImportPaths());
111− appendImportPaths(view->engine(), ::fallbackImportPaths());
113+ appendImportPaths(&engine, ::fallbackImportPaths());
113 CachingNetworkManagerFactory *managerFactory = new CachingNetworkManagerFactory();
115 CachingNetworkManagerFactory *managerFactory = new CachingNetworkManagerFactory();
114− view->engine()->setNetworkAccessManagerFactory(managerFactory);
116+ engine.setNetworkAccessManagerFactory(managerFactory);
116− view->setSource(source);
118+ engine.load(source);
119 int result = application->exec();
120 int result = application->exec();
123 #ifdef UNITY8_ENABLE_TOUCH_EMULATION
122 #ifdef UNITY8_ENABLE_TOUCH_EMULATION
124 delete mouseTouchAdaptor;
123 delete mouseTouchAdaptor;