| QGIS API Documentation
    3.16.0-Hannover (43b64b13f3)
    | 
 
 
 
Go to the documentation of this file.
   18 #ifndef QGSLOCATORFILTER_H 
   19 #define QGSLOCATORFILTER_H 
   26 #include "qgis_core.h" 
   53       , displayString( displayString )
 
   54       , userData( userData )
 
   94     QString group = QString();
 
  117           , iconPath( iconPath )
 
  130     QList<QgsLocatorResult::ResultAction> 
actions;
 
  167     Q_DECLARE_FLAGS( Flags, Flag )
 
  185     virtual QString 
name() 
const = 0;
 
  196     virtual QgsLocatorFilter::Flags flags() 
const;
 
  215     virtual QString 
prefix()
 const { 
return QString(); }
 
  224     virtual QStringList 
prepare( 
const QString &
string, 
const QgsLocatorContext &context ) { Q_UNUSED( 
string ) Q_UNUSED( context ); 
return QStringList();}
 
  259     virtual void triggerResultFromAction( 
const QgsLocatorResult &result, 
const int actionId );
 
  276     bool useWithoutPrefix() 
const;
 
  283     void setUseWithoutPrefix( 
bool useWithoutPrefix );
 
  291     QString activePrefix() 
const;
 
  299     void setActivePrefix( 
const QString &activePrefix ) 
SIP_SKIP;
 
  307     static bool stringMatches( 
const QString &candidate, 
const QString &search );
 
  314     static double fuzzyScore( 
const QString &candidate, 
const QString &search );
 
  320     bool enabled() 
const;
 
  326     void setEnabled( 
bool enabled );
 
  332     virtual bool hasConfigWidget() 
const;
 
  340     virtual void openConfigWidget( QWidget *parent = 
nullptr );
 
  366     bool mEnabled = 
true;
 
  367     bool mUseWithoutPrefix = 
true;
 
  368     QString mActivePrefifx = QString();
 
  376 #endif // QGSLOCATORFILTER_H 
  
Abstract base class for filters which collect locator results.
@ Highest
Highest priority.
virtual QString prefix() const
Returns the search prefix character(s) for this filter.
QString displayString
String displayed for result.
virtual QgsLocatorFilter * clone() const =0
Creates a clone of the filter.
virtual Priority priority() const
Returns the priority for the filter, which controls how results are ordered in the locator.
void finished()
Emitted when the filter finishes fetching results.
virtual QString name() const =0
Returns the unique name for the filter.
QList< QgsLocatorResult::ResultAction > actions
Additional actions to be used in a locator widget for the given result.
ResultAction(int id, QString text, QString iconPath=QString())
Constructor for ResultAction The id used to recognized the action when the result is triggered.
Encapsulates properties of an individual matching result found by a QgsLocatorFilter.
virtual void clearPreviousResults()
This method will be called on main thread on the original filter (not a clone) before fetching result...
Q_DECLARE_METATYPE(QgsMeshTimeSettings)
Encapsulates the properties relating to the context of a locator search.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsField::ConfigurationFlags) CORE_EXPORT QDataStream &operator<<(QDataStream &out
Writes the field to stream out. QGIS version compatibility is not guaranteed.
virtual QString displayName() const =0
Returns a translated, user-friendly name for the filter.
QgsLocatorResult(QgsLocatorFilter *filter, const QString &displayString, const QVariant &userData=QVariant())
Constructor for QgsLocatorResult.
ResultAction()=default
Constructor for ResultAction.
Priority
Filter priority. Controls the order of results in the locator.
void resultFetched(const QgsLocatorResult &result)
Should be emitted by filters whenever they encounter a matching result during within their fetchResul...
virtual QStringList prepare(const QString &string, const QgsLocatorContext &context)
Prepares the filter instance for an upcoming search for the specified string.
The ResultAction stores basic information for additional actions to be used in a locator widget for t...
QIcon icon
Icon for result.
Flag
Flags for locator behavior.
MessageLevel
Level for messages This will be used both for message log and message bar in application.
virtual void fetchResults(const QString &string, const QgsLocatorContext &context, QgsFeedback *feedback)=0
Retrieves the filter results for a specified search string.
virtual void triggerResult(const QgsLocatorResult &result)=0
Triggers a filter result from this filter.
QString description
Descriptive text for result.
QgsLocatorResult()=default
Constructor for QgsLocatorResult.
QVariant userData
Custom reference or other data set by the filter.