diff options
author | 2015-07-24 09:44:47 -0700 | |
---|---|---|
committer | 2015-07-24 09:44:47 -0700 | |
commit | 0029844b1c889a88b4f5785426f4aad4caddc4f9 (patch) | |
tree | 3cb955536237386a64fb09ed75d21d7313e47443 /qt-gui.cpp | |
parent | 292982cdd551b0c42e7f411e3ccade4e50756e6d (diff) | |
parent | e93bb9230f19a054888fc6db09f3757412ab7cc5 (diff) | |
download | subsurface-0029844b1c889a88b4f5785426f4aad4caddc4f9.tar.gz |
Merge branch 'devel' of https://github.com/gracie89/subsurface
Diffstat (limited to 'qt-gui.cpp')
-rw-r--r-- | qt-gui.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/qt-gui.cpp b/qt-gui.cpp index fac743a43..a4997a6fe 100644 --- a/qt-gui.cpp +++ b/qt-gui.cpp @@ -17,6 +17,7 @@ #include <QQuickWindow> #include <QQmlApplicationEngine> #include <QQmlContext> +#include <QSortFilterProxyModel> #include "qt-mobile/qmlmanager.h" #include "qt-models/divelistmodel.h" #include "qt-mobile/qmlprofile.h" @@ -44,8 +45,13 @@ void run_ui() qmlRegisterType<QMLProfile>("org.subsurfacedivelog.mobile", 1, 0, "QMLProfile"); QQmlApplicationEngine engine; DiveListModel diveListModel; + QSortFilterProxyModel *sortModel = new QSortFilterProxyModel(0); + sortModel->setSourceModel(&diveListModel); + sortModel->setDynamicSortFilter(true); + sortModel->setSortRole(DiveListModel::DiveDateRole); + sortModel->sort(0, Qt::DescendingOrder); QQmlContext *ctxt = engine.rootContext(); - ctxt->setContextProperty("diveModel", &diveListModel); + ctxt->setContextProperty("diveModel", sortModel); engine.load(QUrl(QStringLiteral("qrc:///qml/main.qml"))); qqWindowObject = engine.rootObjects().value(0); if (!qqWindowObject) { |