Skip to content

Commit

Permalink
[locator] add a way to invalidate results from python API
Browse files Browse the repository at this point in the history
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
  • Loading branch information
3nids committed Jun 1, 2018
1 parent 6192b5e commit a15d890
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
9 changes: 9 additions & 0 deletions python/gui/auto_generated/qgisinterface.sip.in
Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions src/app/qgisappinterface.cpp
Expand Up @@ -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 );
Expand Down
1 change: 1 addition & 0 deletions src/app/qgisappinterface.h
Expand Up @@ -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;

Expand Down
9 changes: 9 additions & 0 deletions src/gui/qgisinterface.h
Expand Up @@ -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.
Expand Down

0 comments on commit a15d890

Please sign in to comment.