aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--stats/chartlistmodel.cpp12
-rw-r--r--stats/chartlistmodel.h1
-rw-r--r--subsurface-helper.cpp2
3 files changed, 15 insertions, 0 deletions
diff --git a/stats/chartlistmodel.cpp b/stats/chartlistmodel.cpp
index ae9c71748..bce54ce25 100644
--- a/stats/chartlistmodel.cpp
+++ b/stats/chartlistmodel.cpp
@@ -60,6 +60,18 @@ Qt::ItemFlags ChartListModel::flags(const QModelIndex &index) const
: Qt::ItemIsSelectable | Qt::ItemIsEnabled;
}
+QHash<int, QByteArray> ChartListModel::roleNames() const
+{
+ QHash<int, QByteArray> roles;
+ roles[Qt::DisplayRole] = "display";
+ roles[IconRole] = "icon";
+ roles[IconSizeRole] = "iconSize";
+ roles[ChartNameRole] = "chartName";
+ roles[IsHeaderRole] = "isHeader";
+ roles[Qt::UserRole] = "id";
+ return roles;
+}
+
QVariant ChartListModel::data(const QModelIndex &index, int role) const
{
int row = index.row();
diff --git a/stats/chartlistmodel.h b/stats/chartlistmodel.h
index a33f6875a..701dca50e 100644
--- a/stats/chartlistmodel.h
+++ b/stats/chartlistmodel.h
@@ -44,6 +44,7 @@ private:
QFont itemFont;
QFont headerFont;
std::vector<Item> items;
+ QHash<int, QByteArray> roleNames() const override;
int rowCount(const QModelIndex &parent) const override;
QVariant data(const QModelIndex &index, int role) const override;
Qt::ItemFlags flags(const QModelIndex &index) const override;
diff --git a/subsurface-helper.cpp b/subsurface-helper.cpp
index 8fbb74b6a..c3249f03f 100644
--- a/subsurface-helper.cpp
+++ b/subsurface-helper.cpp
@@ -17,6 +17,7 @@
#include "mobile-widgets/qmlmanager.h"
#include "mobile-widgets/qmlinterface.h"
#include "mobile-widgets/statsmanager.h"
+#include "stats/chartlistmodel.h"
#include "qt-models/divesummarymodel.h"
#include "qt-models/gpslistmodel.h"
#include "qt-models/messagehandlermodel.h"
@@ -212,6 +213,7 @@ static void register_qml_types(QQmlEngine *engine)
register_qml_type<QMLProfile>("QMLProfile");
register_qml_type<DiveImportedModel>("DCImportModel");
register_qml_type<DiveSummaryModel>("DiveSummaryModel");
+ register_qml_type<ChartListModel>("ChartListModel");
#endif // not SUBSURFACE_MOBILE
register_qml_type<MapWidgetHelper>("MapWidgetHelper");