mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Use equality instead of substring comparison in suits and buddy filter
This commit is a continuation of commit739b27427c
, in which a substring comparison was replaced by equality comparison to avoid confusing UI behavior of the filter interface. The suit and buddy filters were plagued by the same problem, so change their code in analogy. Fixes #551 (in conjunction with commitdd2466f518
). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
72318f2897
commit
6343515fed
1 changed files with 8 additions and 14 deletions
|
@ -136,13 +136,10 @@ bool SuitsFilterModel::doFilter(dive *d, QModelIndex &index0, QAbstractItemModel
|
|||
|
||||
// there is a suit selected
|
||||
QStringList suitList = stringList();
|
||||
if (!suitList.isEmpty()) {
|
||||
suitList.removeLast(); // remove the "Show Empty Suits";
|
||||
for (int i = 0; i < rowCount(); i++) {
|
||||
if (checkState[i] && (suit.indexOf(stringList()[i]) != -1)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// Ignore last item, since this is the "Show Empty Tags" entry
|
||||
for (int i = 0; i < rowCount() - 1; i++) {
|
||||
if (checkState[i] && suit == suitList[i])
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -243,13 +240,10 @@ bool BuddyFilterModel::doFilter(dive *d, QModelIndex &index0, QAbstractItemModel
|
|||
|
||||
// have at least one buddy
|
||||
QStringList buddyList = stringList();
|
||||
if (!buddyList.isEmpty()) {
|
||||
buddyList.removeLast(); // remove the "Show Empty Tags";
|
||||
for (int i = 0; i < rowCount(); i++) {
|
||||
if (checkState[i] && (diveBuddy.indexOf(stringList()[i]) != -1 || divemaster.indexOf(stringList()[i]) != -1)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// Ignore last item, since this is the "Show Empty Tags" entry
|
||||
for (int i = 0; i < rowCount() - 1; i++) {
|
||||
if (checkState[i] && (diveBuddy == buddyList[i] || divemaster == buddyList[i]))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue