summaryrefslogtreecommitdiffstats
path: root/qt-models
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2020-05-11 07:13:01 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-05-14 12:57:08 -0700
commit4db79c8db9453a28b5e26315baae7d1f5315b68a (patch)
tree64ccf8512e00a019bb2bb6ff3e48d361b0944f75 /qt-models
parent6f96edd766e4f782b0d7ed8cf960a097860b0c7f (diff)
downloadsubsurface-4db79c8db9453a28b5e26315baae7d1f5315b68a.tar.gz
mobile/models: add access to tags string
We already allow filtering by tags, but don't even show them on mobile. That seems rather inconsistent. First step is to make the tags available to the QML layer. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-models')
-rw-r--r--qt-models/divetripmodel.cpp1
-rw-r--r--qt-models/mobilelistmodel.cpp1
-rw-r--r--qt-models/mobilelistmodel.h1
3 files changed, 3 insertions, 0 deletions
diff --git a/qt-models/divetripmodel.cpp b/qt-models/divetripmodel.cpp
index db086ca59..a153b31c7 100644
--- a/qt-models/divetripmodel.cpp
+++ b/qt-models/divetripmodel.cpp
@@ -222,6 +222,7 @@ QVariant DiveTripModelBase::diveData(const struct dive *d, int column, int role)
case MobileListModel::SumWeightRole: return get_weight_string(weight_t { total_weight(d) }, true);
case MobileListModel::DiveMasterRole: return d->divemaster ? d->divemaster : QString();
case MobileListModel::BuddyRole: return d->buddy ? d->buddy : QString();
+ case MobileListModel::TagsRole: return get_taglist_string(d->tag_list);
case MobileListModel::NotesRole: return formatNotes(d);
case MobileListModel::GpsRole: return d->dive_site ? printGPSCoords(&d->dive_site->location) : QString();
case MobileListModel::GpsDecimalRole: return format_gps_decimal(d);
diff --git a/qt-models/mobilelistmodel.cpp b/qt-models/mobilelistmodel.cpp
index 17ec252d7..cf1db1860 100644
--- a/qt-models/mobilelistmodel.cpp
+++ b/qt-models/mobilelistmodel.cpp
@@ -33,6 +33,7 @@ QHash<int, QByteArray> MobileListModelBase::roleNames() const
roles[SumWeightRole] = "sumWeight";
roles[DiveMasterRole] = "diveMaster";
roles[BuddyRole] = "buddy";
+ roles[TagsRole] = "tags";
roles[NotesRole]= "notes";
roles[GpsRole] = "gps";
roles[GpsDecimalRole] = "gpsDecimal";
diff --git a/qt-models/mobilelistmodel.h b/qt-models/mobilelistmodel.h
index e315e9ebd..e18481efc 100644
--- a/qt-models/mobilelistmodel.h
+++ b/qt-models/mobilelistmodel.h
@@ -41,6 +41,7 @@ public:
SumWeightRole,
DiveMasterRole,
BuddyRole,
+ TagsRole,
NotesRole,
GpsDecimalRole,
GpsRole,