summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-11 02:36:09 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-11 02:36:09 -0800
commitd06cc2c68e10bb3674c8f13d0cc8abbe78b0a2c8 (patch)
treef9bddb43ab690afd3c6639d4ad4f5dfef0c36a06 /qt-ui
parentf9b9535c6921e096583d1872cbf05cfea2252c11 (diff)
downloadsubsurface-d06cc2c68e10bb3674c8f13d0cc8abbe78b0a2c8.tar.gz
Show the number of dives with each tag in the filter panel
This is a rather brute force implementation. It might be worth while caching this information - but I'd like to do some benchmarking, first. Sadly this code also shows that there are some bugs hidden in the selection code when filtering is present. When a trip is selected all dives in the trip get selected, even those that are not visible under the current filter. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/models.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
index 5309e2860..7c0b35cee 100644
--- a/qt-ui/models.cpp
+++ b/qt-ui/models.cpp
@@ -2268,7 +2268,9 @@ QVariant TagFilterModel::data(const QModelIndex &index, int role) const
if (role == Qt::CheckStateRole) {
return checkState[index.row()] ? Qt::Checked : Qt::Unchecked;
} else if (role == Qt::DisplayRole) {
- return stringList()[index.row()];
+ QString tag = stringList()[index.row()];
+ int count = count_dives_with_tag(tag.toUtf8().data());
+ return tag + QString("(%1)").arg(count);
}
return QVariant();
}