Desktop: don't show special dive site entries if there is no filter

In the dive site selection widget there are two special entries
(add dive site with given name). Don't show this if the user didn't
enter a string.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-04-15 22:26:11 +02:00 committed by Dirk Hohndel
parent 09c0d7a6f5
commit ee19b067a7

View file

@ -267,6 +267,11 @@ void DiveLocationFilterProxyModel::setFilter(const QString &filterIn)
bool DiveLocationFilterProxyModel::filterAcceptsRow(int source_row, const QModelIndex&) const
{
// We don't want to show the first two entries (add dive site with that name)
// if there is no filter text.
if (filter.isEmpty() && source_row <= 1)
return false;
if (source_row == 0)
return true;