diff options
author | Grace Karanja <gracie.karanja89@gmail.com> | 2015-05-27 15:36:39 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-06-20 14:18:32 -0700 |
commit | 6ef082a4a20d56a9ee4c7313bc1675a42606e35a (patch) | |
tree | 8ae4fd934bf213acef1e1efea1a656db01c02403 /qt-gui.cpp | |
parent | 48a54d034863ec4b9a4e68a725dbc78e8629f2a5 (diff) | |
download | subsurface-6ef082a4a20d56a9ee4c7313bc1675a42606e35a.tar.gz |
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>
Diffstat (limited to 'qt-gui.cpp')
-rw-r--r-- | qt-gui.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/qt-gui.cpp b/qt-gui.cpp index 713fd53cd..fdcae2c77 100644 --- a/qt-gui.cpp +++ b/qt-gui.cpp @@ -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(); } |