mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
bf882416f9
commit
b7e4b35cde
6 changed files with 392 additions and 4 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue