[locator] add a way to invalidate results from python API

otherwise if you access the config of the filter (or change app settings) from outside the main application settings dialog, results are not invalidate

for instance, if you update a URL of a service, results won't be updated
This commit is contained in:
Denis Rouzaud 2018-05-31 11:01:41 -04:00
parent 6192b5eb36
commit a15d8903ed
4 changed files with 24 additions and 0 deletions

View File

@ -1102,6 +1102,15 @@ deregisterLocatorFilter() to deregister their filters upon plugin unload to avoi
.. seealso:: :py:func:`registerLocatorFilter`
.. versionadded:: 3.0
%End
virtual void invalidateLocatorResults() = 0;
%Docstring
Invalidate results from the locator filter.
This might be useful if the configuration of the filter changed without going through main application settings.
.. versionadded:: 3.2
%End
virtual bool askForDatumTransform( QgsCoordinateReferenceSystem sourceCrs, QgsCoordinateReferenceSystem destinationCrs ) = 0;

View File

@ -774,6 +774,11 @@ void QgisAppInterface::deregisterLocatorFilter( QgsLocatorFilter *filter )
qgis->mLocatorWidget->locator()->deregisterFilter( filter );
}
void QgisAppInterface::invalidateLocatorResults()
{
qgis->mLocatorWidget->invalidateResults();
}
bool QgisAppInterface::askForDatumTransform( QgsCoordinateReferenceSystem sourceCrs, QgsCoordinateReferenceSystem destinationCrs )
{
return qgis->askUserForDatumTransform( sourceCrs, destinationCrs );

View File

@ -544,6 +544,7 @@ class APP_EXPORT QgisAppInterface : public QgisInterface
void registerLocatorFilter( QgsLocatorFilter *filter ) override;
void deregisterLocatorFilter( QgsLocatorFilter *filter ) override;
void invalidateLocatorResults() override;
bool askForDatumTransform( QgsCoordinateReferenceSystem sourceCrs, QgsCoordinateReferenceSystem destinationCrs ) override;

View File

@ -902,6 +902,15 @@ class GUI_EXPORT QgisInterface : public QObject
*/
virtual void deregisterLocatorFilter( QgsLocatorFilter *filter ) = 0;
/**
* Invalidate results from the locator filter.
*
* This might be useful if the configuration of the filter changed without going through main application settings.
*
* \since QGIS 3.2
*/
virtual void invalidateLocatorResults() = 0;
/**
* Checks available datum transforms and ask user if several are available and none
* is chosen. Dialog is shown only if global option is set accordingly.