diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2014-11-12 16:01:58 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-11-12 16:02:37 -0800 |
commit | 61dc19d2e0bc69004b03a990993eda547f4e0093 (patch) | |
tree | 0cb4af2322199c5ef65bf1083d8a3f4c2e7ac083 /qt-ui | |
parent | 5a329ff26295717181dd99b22dab5b6b1e80d821 (diff) | |
download | subsurface-61dc19d2e0bc69004b03a990993eda547f4e0093.tar.gz |
Show the number of dives with given person / location in the filter panel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/models.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp index c7886d2b9..a8e561272 100644 --- a/qt-ui/models.cpp +++ b/qt-ui/models.cpp @@ -2270,7 +2270,7 @@ QVariant TagFilterModel::data(const QModelIndex &index, int role) const } else if (role == Qt::DisplayRole) { QString tag = stringList()[index.row()]; int count = count_dives_with_tag(tag.toUtf8().data()); - return tag + QString("(%1)").arg(count); + return tag + QString(" (%1)").arg(count); } return QVariant(); } @@ -2467,7 +2467,9 @@ QVariant BuddyFilterModel::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 person = stringList()[index.row()]; + int count = count_dives_with_person(person.toUtf8().data()); + return person + QString(" (%1)").arg(count); } return QVariant(); } @@ -2499,7 +2501,9 @@ QVariant LocationFilterModel::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 location = stringList()[index.row()]; + int count = count_dives_with_location(location.toUtf8().data()); + return location + QString(" (%1)").arg(count); } return QVariant(); } |