QGIS API Documentation  3.0.2-Girona (307d082)
qgslocatorfilter.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgslocatorfilter.cpp
3  --------------------
4  begin : May 2017
5  copyright : (C) 2017 by Nyall Dawson
6  email : nyall dot dawson at gmail dot com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 
19 #include "qgslocatorfilter.h"
20 #include "qgsstringutils.h"
21 #include "qgsfeedback.h"
22 #include <QThread>
23 
25  : QObject( parent )
26 {
27 
28 }
29 
30 QgsLocatorFilter::Flags QgsLocatorFilter::flags() const
31 {
32  return nullptr;
33 }
34 
35 bool QgsLocatorFilter::stringMatches( const QString &candidate, const QString &search )
36 {
37  return !search.isEmpty() && candidate.contains( search, Qt::CaseInsensitive );
38 }
39 
41 {
42  return mEnabled;
43 }
44 
46 {
47  mEnabled = enabled;
48 }
49 
51 {
52  return false;
53 }
54 
55 void QgsLocatorFilter::openConfigWidget( QWidget *parent )
56 {
57  Q_UNUSED( parent );
58 }
59 
61 {
62  return mUseWithoutPrefix;
63 }
64 
66 {
67  mUseWithoutPrefix = useWithoutPrefix;
68 }
void setEnabled(bool enabled)
Sets whether the filter is enabled.
static bool stringMatches(const QString &candidate, const QString &search)
Tests a candidate string to see if it should be considered a match for a specified search string...
void setUseWithoutPrefix(bool useWithoutPrefix)
Sets whether the filter should be used when no prefix is entered.
bool useWithoutPrefix() const
Returns true if the filter should be used when no prefix is entered.
QgsLocatorFilter(QObject *parent=nullptr)
Constructor for QgsLocatorFilter.
virtual QgsLocatorFilter::Flags flags() const
Returns flags which specify the filter&#39;s behavior.
bool enabled() const
Returns true if the filter is enabled.
virtual void openConfigWidget(QWidget *parent=nullptr)
Opens the configuration widget for the filter (if it has one), with the specified parent widget...
virtual bool hasConfigWidget() const
Should return true if the filter has a configuration widget.