summaryrefslogtreecommitdiffstats
path: root/qt-gui.cpp
diff options
context:
space:
mode:
authorGravatar Grace Karanja <gracie.karanja89@gmail.com>2015-06-09 22:20:44 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-20 14:26:56 -0700
commitb7e4b35cde1f1a6be01818eac94732186a1b99ab (patch)
tree4dfa16a09d9e0ec8526d05ce1b4107b8c122d81e /qt-gui.cpp
parentbf882416f92fef648f8951a55b4b06dacf56bc3b (diff)
downloadsubsurface-b7e4b35cde1f1a6be01818eac94732186a1b99ab.tar.gz
Add DiveListModel
This model will be used to show the dives in QML. This commit adds the model, and the means to link it to QML. 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.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/qt-gui.cpp b/qt-gui.cpp
index 9b6c1051c..e5ff6aa23 100644
--- a/qt-gui.cpp
+++ b/qt-gui.cpp
@@ -16,7 +16,9 @@
#ifdef SUBSURFACE_MOBILE
#include <QQuickWindow>
#include <QQmlApplicationEngine>
+ #include <QQmlContext>
#include "qt-mobile/qmlmanager.h"
+ #include "qt-models/divelistmodel.h"
#endif
static MainWindow *window = NULL;
@@ -38,6 +40,9 @@ void run_ui()
window->hide();
qmlRegisterType<QMLManager>("org.subsurfacedivelog.mobile", 1, 0, "QMLManager");
QQmlApplicationEngine engine;
+ DiveListModel diveListModel;
+ QQmlContext *ctxt = engine.rootContext();
+ ctxt->setContextProperty("diveModel", &diveListModel);
engine.load(QUrl(QStringLiteral("qrc:///qml/main.qml")));
QObject *mainWindow = engine.rootObjects().value(0);
QQuickWindow *qml_window = qobject_cast<QQuickWindow *>(mainWindow);