1
0
Fork 0
mirror of https://github.com/subsurface/subsurface.git synced 2025-02-19 22:16:15 +00:00

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>
This commit is contained in:
Dirk Hohndel 2014-11-11 02:36:09 -08:00
parent f9b9535c69
commit d06cc2c68e

View file

@ -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();
}