18#ifndef QGSLOCATORFILTER_H
19#define QGSLOCATORFILTER_H
42 Q_PROPERTY( QVariant userData READ userData WRITE setUserData )
43 Q_PROPERTY( QString displayString MEMBER displayString )
44 Q_PROPERTY( QString description MEMBER description )
45 Q_PROPERTY(
double score MEMBER score )
46 Q_PROPERTY( QString group MEMBER group )
47 Q_PROPERTY(
double groupScore MEMBER groupScore )
58 , displayString( displayString )
59 , mUserData( userData )
67 QVariant userData() const
SIP_PYNAME( _userData );
74 void setUserData( const QVariant &userData );
84 QString displayString;
117 double groupScore = 0;
140 , iconPath( iconPath )
153 QList<QgsLocatorResult::ResultAction>
actions;
219 virtual QString
name()
const = 0;
255 virtual QString
prefix()
const {
return QString(); }
264 virtual QStringList
prepare(
const QString &
string,
const QgsLocatorContext &context ) { Q_UNUSED(
string ) Q_UNUSED( context );
return QStringList();}
315 virtual void triggerResultFromAction(
const QgsLocatorResult &result,
const int actionId );
332 bool useWithoutPrefix()
const;
339 void setUseWithoutPrefix(
bool useWithoutPrefix );
347 QString activePrefix()
const;
355 void setActivePrefix(
const QString &activePrefix )
SIP_SKIP;
363 static bool stringMatches(
const QString &candidate,
const QString &search );
370 static double fuzzyScore(
const QString &candidate,
const QString &search );
376 bool enabled()
const;
382 void setEnabled(
bool enabled );
388 virtual bool hasConfigWidget()
const;
396 virtual void openConfigWidget( QWidget *parent =
nullptr );
436 bool mEnabled =
true;
437 bool mUseWithoutPrefix =
true;
438 QString mActivePrefifx = QString();
439 int mFetchResultsDelay = 0;
MessageLevel
Level for messages This will be used both for message log and message bar in application.
@ Info
Information message.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Encapsulates the properties relating to the context of a locator search.
Abstract base class for filters which collect locator results.
virtual QString prefix() const
Returns the search prefix character(s) for this filter.
Flag
Flags for locator behavior.
int fetchResultsDelay() const
Returns the delay (in milliseconds) for the filter to wait prior to fetching results.
Priority
Filter priority. Controls the order of results in the locator.
@ Highest
Highest priority.
void setFetchResultsDelay(int delay)
Sets a delay (in milliseconds) for the filter to wait prior to fetching results.
virtual QString description() const
Returns a translated, description for the filter.
void finished()
Emitted when the filter finishes fetching results.
virtual QString displayName() const =0
Returns a translated, user-friendly name for the filter.
virtual Priority priority() const
Returns the priority for the filter, which controls how results are ordered in the locator.
virtual QString name() const =0
Returns the unique name for the filter.
virtual void triggerResult(const QgsLocatorResult &result)=0
Triggers a filter result from this filter.
virtual QgsLocatorFilter * clone() const =0
Creates a clone of the filter.
virtual void resultDeselected(const QgsLocatorResult &result)
This is called when a result is deselected.
virtual void clearPreviousResults()
This method will be called on main thread on the original filter (not a clone) before fetching result...
virtual void resultSelected(const QgsLocatorResult &result)
This is called when the result is selected by the user.
void resultFetched(const QgsLocatorResult &result)
Should be emitted by filters whenever they encounter a matching result during within their fetchResul...
virtual void fetchResults(const QString &string, const QgsLocatorContext &context, QgsFeedback *feedback)=0
Retrieves the filter results for a specified search string.
virtual QStringList prepare(const QString &string, const QgsLocatorContext &context)
Prepares the filter instance for an upcoming search for the specified string.
Encapsulates properties of an individual matching result found by a QgsLocatorFilter.
QList< QgsLocatorResult::ResultAction > actions
Additional actions to be used in a locator widget for the given result.
QgsSettingsTreeNamedListNode is a named list tree node for the settings tree to help organizing and i...
QgsSettingsTreeNamedListNode * createNamedListNode(const QString &key, const Qgis::SettingsTreeNodeOptions &options=Qgis::SettingsTreeNodeOptions())
Creates a named list tree node.
static QgsSettingsTreeNode * sTreeApp
#define SIP_ENUM_BASETYPE(type)
Q_DECLARE_METATYPE(QgsDatabaseQueryLogEntry)
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsTextRendererUtils::CurvedTextFlags)
The ResultAction stores basic information for additional actions to be used in a locator widget for t...
ResultAction(int id, QString text, QString iconPath=QString())
Constructor for ResultAction The id used to recognized the action when the result is triggered.