Skip to content
Permalink
Browse files

Invalidate current locator results when locator options are changed

  • Loading branch information
nyalldawson committed May 17, 2017
1 parent 7635b44 commit df9d9f674875b43cb704c037cd8d5d56f156831d
@@ -49,6 +49,12 @@ class QgsLocatorWidget : QWidget
Triggers the locator widget to focus, open and start searching for a specified ``string``.
%End

void invalidateResults();
%Docstring
Invalidates the current search results, e.g. as a result of changes to the locator
filter settings.
%End

signals:

void configTriggered();
@@ -16,11 +16,13 @@
***************************************************************************/

#include "qgslocatoroptionswidget.h"
#include "qgslocatorwidget.h"
#include "qgssettings.h"

QgsLocatorOptionsWidget::QgsLocatorOptionsWidget( QgsLocator *locator, QWidget *parent )
QgsLocatorOptionsWidget::QgsLocatorOptionsWidget( QgsLocatorWidget *locator, QWidget *parent )
: QWidget( parent )
, mLocator( locator )
, mLocatorWidget( locator )
, mLocator( locator->locator() )
{
setupUi( this );

@@ -34,6 +36,7 @@ QgsLocatorOptionsWidget::QgsLocatorOptionsWidget( QgsLocator *locator, QWidget *
void QgsLocatorOptionsWidget::commitChanges()
{
mModel->commitChanges();
mLocatorWidget->invalidateResults();
}


@@ -23,21 +23,23 @@
#include "ui_qgslocatoroptionswidgetbase.h"

class QgsLocatorFiltersModel;
class QgsLocatorWidget;

class QgsLocatorOptionsWidget : public QWidget, private Ui::QgsLocatorOptionsWidgetBase
{
Q_OBJECT

public:

QgsLocatorOptionsWidget( QgsLocator *locator, QWidget *parent = nullptr );
QgsLocatorOptionsWidget( QgsLocatorWidget *locator, QWidget *parent = nullptr );

public slots:

void commitChanges();

private:

QgsLocatorWidget *mLocatorWidget = nullptr;
QgsLocator *mLocator = nullptr;
QgsLocatorFiltersModel *mModel = nullptr;
};
@@ -943,7 +943,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
mVariableEditor->setEditableScopeIndex( 0 );

// locator
mLocatorOptionsWidget = new QgsLocatorOptionsWidget( QgisApp::instance()->locatorWidget()->locator(), this );
mLocatorOptionsWidget = new QgsLocatorOptionsWidget( QgisApp::instance()->locatorWidget(), this );
QVBoxLayout *locatorLayout = new QVBoxLayout();
locatorLayout->addWidget( mLocatorOptionsWidget );
mOptionsLocatorGroupBox->setLayout( locatorLayout );
@@ -122,6 +122,13 @@ void QgsLocatorWidget::search( const QString &string )
performSearch();
}

void QgsLocatorWidget::invalidateResults()
{
mLocator->cancelWithoutBlocking();
mLocatorModel->clear();
mResultsContainer->hide();
}

void QgsLocatorWidget::scheduleDelayedPopup()
{
mPopupTimer.start();
@@ -74,6 +74,12 @@ class GUI_EXPORT QgsLocatorWidget : public QWidget
*/
void search( const QString &string );

/**
* Invalidates the current search results, e.g. as a result of changes to the locator
* filter settings.
*/
void invalidateResults();

signals:

/**

0 comments on commit df9d9f6

Please sign in to comment.
You can’t perform that action at this time.