From ee19b067a700e2d2e0447488f2fa39f869eb633f Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Mon, 15 Apr 2019 22:26:11 +0200 Subject: 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 --- desktop-widgets/locationinformation.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'desktop-widgets/locationinformation.cpp') diff --git a/desktop-widgets/locationinformation.cpp b/desktop-widgets/locationinformation.cpp index dfceb8cd1..d1a11c03d 100644 --- a/desktop-widgets/locationinformation.cpp +++ b/desktop-widgets/locationinformation.cpp @@ -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; -- cgit v1.2.3-70-g09d2