Subgroup: Locator
Class: QgsLocator¶
-
class
qgis.core.
QgsLocator
¶ Bases:
PyQt5.QtCore.QObject
Handles the management of QgsLocatorFilter objects and async collection of search results from them.
QgsLocator acts as both a registry for QgsLocatorFilter objects and a means of firing up asynchronous queries against these filter objects.
Filters are first registered to the locator by calling registerFilter(). Registering filters transfers their ownership to the locator object. Plugins which register filters to the locator must take care to correctly call deregisterFilter() and deregister their filter upon plugin unload to avoid crashes.
In order to trigger a search across registered filters, the fetchResults() method is called. This triggers threaded calls to QgsLocatorFilter.fetchResults() for all registered filters. As individual filters find matching results, the foundResult() signal will be triggered for each result. Callers should connect this signal to an appropriate slot designed to collect and handle these results. Since foundResult() is triggered whenever a filter encounters an individual result, it will usually be triggered many times for a single call to fetchResults().
New in version 3.0: Methods
blockSignals
cancel
Cancels any current running query, and blocks until query is completely canceled by all filters. cancelWithoutBlocking
Triggers cancelation of any current running query without blocking. childEvent
children
connectNotify
customEvent
deleteLater
deregisterFilter
Deregisters a filter
from the locator and deletes it.disconnect
disconnectNotify
dumpObjectInfo
dumpObjectTree
dynamicPropertyNames
event
eventFilter
fetchResults
Triggers the background fetching of filter results for a specified search string
.filters
Returns the list of filters registered in the locator. findChild
findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject findChildren
findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] inherits
installEventFilter
isRunning
Returns true if a query is currently being executed by the locator. isSignalConnected
isWidgetType
isWindowType
killTimer
metaObject
moveToThread
objectName
parent
prefixedFilters
Returns a map of prefix to filter, for all registered filters with valid prefixes. property
pyqtConfigure
Each keyword argument is either the name of a Qt property or a Qt signal. receivers
registerFilter
Registers a filter
within the locator.removeEventFilter
sender
senderSignalIndex
setObjectName
setParent
setProperty
signalsBlocked
startTimer
thread
timerEvent
tr
Attributes
destroyed
destroyed(self, QObject = None) [signal] finished
Emitted when locator has finished a query, either as a result of successful completion or early cancelation. foundResult
Emitted whenever a filter encounters a matching result
after the fetchResults() method is called.objectNameChanged
objectNameChanged(self, str) [signal] staticMetaObject
-
cancel
(self)¶ Cancels any current running query, and blocks until query is completely canceled by all filters.
See also
-
cancelWithoutBlocking
(self)¶ Triggers cancelation of any current running query without blocking. The query may take some time to cancel after calling this.
See also
-
childEvent
()¶
-
connectNotify
()¶
-
customEvent
()¶
-
deregisterFilter
(self, filter: QgsLocatorFilter)¶ Deregisters a
filter
from the locator and deletes it. Calling this will block whilst any currently running query is terminated.Plugins which register filters to the locator must take care to correctly call deregisterFilter() to deregister their filters upon plugin unload to avoid crashes.
See also
-
disconnectNotify
()¶
-
fetchResults
(self, string: str, context: QgsLocatorContext, feedback: QgsFeedback = None)¶ Triggers the background fetching of filter results for a specified search
string
. Thecontext
argument encapsulates the context relating to the search (such as a map extent to prioritize).If specified, the
feedback
object must exist for the lifetime of this query.The foundResult() signal will be emitted for each individual result encountered by the registered filters.
-
filters
(self) → object¶ Returns the list of filters registered in the locator.
See also
-
finished
¶ Emitted when locator has finished a query, either as a result of successful completion or early cancelation. [signal]
-
foundResult
¶ Emitted whenever a filter encounters a matching
result
after the fetchResults() method is called. [signal]
-
isRunning
(self) → bool¶ Returns true if a query is currently being executed by the locator.
-
isSignalConnected
()¶
-
prefixedFilters
(self) → object¶ Returns a map of prefix to filter, for all registered filters with valid prefixes.
See also
-
receivers
()¶
-
registerFilter
(self, filter: QgsLocatorFilter)¶ Registers a
filter
within the locator. Ownership of the filter is transferred to the locator.Warning
Plugins which register filters to the locator must take care to correctly call deregisterFilter() and deregister their filters upon plugin unload to avoid crashes.
See also
-
sender
()¶
-
senderSignalIndex
()¶
-
timerEvent
()¶
-