Load main.qml on startup for mobile builds

When cmake is run with -DSUBSURFACE_MOBILE=True, the initial window
will be main.qml, instead of the MainWindow used when cmake is run
with -DSUBSURFACE_MOBILE=False

Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Grace Karanja 2015-05-27 15:36:39 +03:00 committed by Dirk Hohndel
parent 48a54d0348
commit 6ef082a4a2

View file

@ -9,7 +9,9 @@
#include <QDesktopWidget>
#include <QNetworkProxy>
#include <QLibraryInfo>
#include <QTextCodec>
#include <QQuickWindow>
#include <QQmlApplicationEngine>
#include "qt-gui.h"
@ -28,7 +30,15 @@ void init_ui()
void run_ui()
{
#ifdef SUBSURFACE_MOBILE
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:///qml/main.qml")));
QObject *mainWindow = engine.rootObjects().value(0);
QQuickWindow *qml_window = qobject_cast<QQuickWindow *>(mainWindow);
qml_window->show();
#else
window->show();
#endif
qApp->exec();
}