From d06cc2c68e10bb3674c8f13d0cc8abbe78b0a2c8 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 11 Nov 2014 02:36:09 -0800 Subject: 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 --- qt-ui/models.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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(); } -- cgit v1.2.3-70-g09d2