|
| 1 | +/************************************************************************ |
| 2 | + * This file has been generated automatically from * |
| 3 | + * * |
| 4 | + * src/gui/locator/qgslocator.h * |
| 5 | + * * |
| 6 | + * Do not edit manually ! Edit header and run scripts/sipify.pl again * |
| 7 | + ************************************************************************/ |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | +class QgsLocator : QObject |
| 13 | +{ |
| 14 | +%Docstring |
| 15 | + Handles the management of QgsLocatorFilter objects and async collection of search results from them. |
| 16 | + |
| 17 | + QgsLocator acts as both a registry for QgsLocatorFilter objects and a means of firing up |
| 18 | + asynchronous queries against these filter objects. |
| 19 | + |
| 20 | + Filters are first registered to the locator by calling registerFilter(). Registering filters |
| 21 | + transfers their ownership to the locator object. Plugins which register filters to the locator |
| 22 | + must take care to correctly call deregisterFilter() and deregister their filter upon plugin |
| 23 | + unload to avoid crashes. |
| 24 | + |
| 25 | + In order to trigger a search across registered filters, the fetchResults() method is called. |
| 26 | + This triggers threaded calls to QgsLocatorFilter.fetchResults() for all registered filters. |
| 27 | + As individual filters find matching results, the foundResult() signal will be triggered |
| 28 | + for each result. Callers should connect this signal to an appropriate slot designed |
| 29 | + to collect and handle these results. Since foundResult() is triggered whenever a filter |
| 30 | + encounters an individual result, it will usually be triggered many times for a single |
| 31 | + call to fetchResults(). |
| 32 | + |
| 33 | +.. versionadded:: 3.0 |
| 34 | +%End |
| 35 | + |
| 36 | +%TypeHeaderCode |
| 37 | +#include "qgslocator.h" |
| 38 | +%End |
| 39 | + public: |
| 40 | + |
| 41 | + QgsLocator( QObject *parent /TransferThis/ = 0 ); |
| 42 | +%Docstring |
| 43 | + Constructor for QgsLocator. |
| 44 | +%End |
| 45 | + |
| 46 | + ~QgsLocator(); |
| 47 | +%Docstring |
| 48 | + Destructor for QgsLocator. Destruction will block while any currently running query is terminated. |
| 49 | +%End |
| 50 | + |
| 51 | + void registerFilter( QgsLocatorFilter *filter /Transfer/ ); |
| 52 | +%Docstring |
| 53 | + Registers a ``filter`` within the locator. Ownership of the filter is transferred to the |
| 54 | + locator. |
| 55 | + \warning Plugins which register filters to the locator must take care to correctly call |
| 56 | + deregisterFilter() and deregister their filters upon plugin unload to avoid crashes. |
| 57 | +.. seealso:: deregisterFilter() |
| 58 | +%End |
| 59 | + |
| 60 | + void deregisterFilter( QgsLocatorFilter *filter ); |
| 61 | +%Docstring |
| 62 | + Deregisters a ``filter`` from the locator and deletes it. Calling this will block whilst |
| 63 | + any currently running query is terminated. |
| 64 | + |
| 65 | + Plugins which register filters to the locator must take care to correctly call |
| 66 | + deregisterFilter() to deregister their filters upon plugin unload to avoid crashes. |
| 67 | + |
| 68 | +.. seealso:: registerFilter() |
| 69 | +%End |
| 70 | + |
| 71 | + QList< QgsLocatorFilter *> filters(); |
| 72 | +%Docstring |
| 73 | + Returns the list of filters registered in the locator. |
| 74 | +.. seealso:: prefixedFilters() |
| 75 | + :rtype: list of QgsLocatorFilter |
| 76 | +%End |
| 77 | + |
| 78 | + QMap< QString, QgsLocatorFilter *> prefixedFilters() const; |
| 79 | +%Docstring |
| 80 | + Returns a map of prefix to filter, for all registered filters |
| 81 | + with valid prefixes. |
| 82 | +.. seealso:: filters() |
| 83 | + :rtype: QMap< str, QgsLocatorFilter *> |
| 84 | +%End |
| 85 | + |
| 86 | + void fetchResults( const QString &string, const QgsLocatorContext &context, QgsFeedback *feedback = 0 ); |
| 87 | +%Docstring |
| 88 | + Triggers the background fetching of filter results for a specified search ``string``. |
| 89 | + The ``context`` argument encapsulates the context relating to the search (such as a map |
| 90 | + extent to prioritize). |
| 91 | + |
| 92 | + If specified, the ``feedback`` object must exist for the lifetime of this query. |
| 93 | + |
| 94 | + The foundResult() signal will be emitted for each individual result encountered |
| 95 | + by the registered filters. |
| 96 | +%End |
| 97 | + |
| 98 | + void cancel(); |
| 99 | +%Docstring |
| 100 | + Cancels any current running query, and blocks until query is completely canceled by |
| 101 | + all filters. |
| 102 | +.. seealso:: cancelWithoutBlocking() |
| 103 | +%End |
| 104 | + |
| 105 | + void cancelWithoutBlocking(); |
| 106 | +%Docstring |
| 107 | + Triggers cancelation of any current running query without blocking. The query may |
| 108 | + take some time to cancel after calling this. |
| 109 | +.. seealso:: cancel() |
| 110 | +%End |
| 111 | + |
| 112 | + bool isRunning() const; |
| 113 | +%Docstring |
| 114 | + Returns true if a query is currently being executed by the locator. |
| 115 | + :rtype: bool |
| 116 | +%End |
| 117 | + |
| 118 | + signals: |
| 119 | + |
| 120 | + void foundResult( const QgsLocatorResult &result ); |
| 121 | +%Docstring |
| 122 | + Emitted whenever a filter encounters a matching ``result`` after the fetchResults() method |
| 123 | + is called. |
| 124 | +%End |
| 125 | + |
| 126 | + void finished(); |
| 127 | +%Docstring |
| 128 | + Emitted when locator has finished a query, either as a result |
| 129 | + of successful completion or early cancelation. |
| 130 | +%End |
| 131 | + |
| 132 | +}; |
| 133 | + |
| 134 | + |
| 135 | + |
| 136 | +/************************************************************************ |
| 137 | + * This file has been generated automatically from * |
| 138 | + * * |
| 139 | + * src/gui/locator/qgslocator.h * |
| 140 | + * * |
| 141 | + * Do not edit manually ! Edit header and run scripts/sipify.pl again * |
| 142 | + ************************************************************************/ |
0 commit comments