Location completion matches on whole name

When typing in a partial location name, the match now considers the whole
text, not just the start of the text. So typing in "Yell" will match both
"Yellow House" and "Mellow Yellow".

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-11-24 11:11:39 -08:00
parent 2c77aa5519
commit dabb6b2033

View file

@ -290,7 +290,7 @@ bool DiveLocationFilterProxyModel::filterAcceptsRow(int source_row, const QModel
return true;
QString sourceString = sourceModel()->index(source_row, DiveLocationModel::NAME).data(Qt::DisplayRole).toString();
return sourceString.toLower().startsWith(location_line_edit->text().toLower());
return sourceString.toLower().contains(location_line_edit->text().toLower());
}
bool DiveLocationFilterProxyModel::lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const