diff --git a/src/core/locator/qfieldlocatorfilter.cpp b/src/core/locator/qfieldlocatorfilter.cpp index 631290f99c..879abcda3b 100644 --- a/src/core/locator/qfieldlocatorfilter.cpp +++ b/src/core/locator/qfieldlocatorfilter.cpp @@ -31,6 +31,7 @@ QFieldLocatorFilter::QFieldLocatorFilter( QObject *parent ) QFieldLocatorFilter *QFieldLocatorFilter::clone() const { QFieldLocatorFilter *filter = new QFieldLocatorFilter(); + filter->setFetchResultsDelay( fetchResultsDelay() ); filter->setName( mName ); filter->setDisplayName( mDisplayName ); filter->setPrefix( mPrefix ); @@ -74,6 +75,15 @@ void QFieldLocatorFilter::setLocatorBridge( LocatorModelSuperBridge *locatorBrid emit locatorBridgeChanged(); } +void QFieldLocatorFilter::setDelay( int delay ) +{ + if ( fetchResultsDelay() == delay ) + return; + + setFetchResultsDelay( delay ); + emit delayChanged(); +} + void QFieldLocatorFilter::setName( const QString &name ) { if ( mName == name ) diff --git a/src/core/locator/qfieldlocatorfilter.h b/src/core/locator/qfieldlocatorfilter.h index e232871d11..ffa49a8c68 100644 --- a/src/core/locator/qfieldlocatorfilter.h +++ b/src/core/locator/qfieldlocatorfilter.h @@ -35,6 +35,7 @@ class QFieldLocatorFilter : public QgsLocatorFilter { Q_OBJECT + Q_PROPERTY( int delay READ delay WRITE setDelay NOTIFY delayChanged ) Q_PROPERTY( QString name READ name WRITE setName NOTIFY nameChanged ) Q_PROPERTY( QString displayName READ displayName WRITE setDisplayName NOTIFY displayNameChanged ) Q_PROPERTY( QString prefix READ prefix WRITE setPrefix NOTIFY prefixChanged ) @@ -50,6 +51,12 @@ class QFieldLocatorFilter : public QgsLocatorFilter //! Clone the locator filter QFieldLocatorFilter *clone() const override; + //! Returns the delay before which the fetching of results is triggered + int delay() const { return fetchResultsDelay(); } + + //! Sets the delay before which the fetching of results is triggered + void setDelay( int delay ); + //! \copydoc QgsLocatorFilter::name QString name() const override { return mName; } @@ -115,6 +122,9 @@ class QFieldLocatorFilter : public QgsLocatorFilter void triggerResultFromAction( const QgsLocatorResult &result, const int actionId ) override; signals: + //! Emitted when the fetch result delay has changed + void delayChanged(); + //! Emitted when the name has changed void nameChanged();