Skip to content
Permalink
Browse files

also move triggering of results to core

  • Loading branch information
3nids committed Nov 8, 2018
1 parent dd14e58 commit 31cd1644c343f307e0c46d8c490be3a61c1ce73b
@@ -53,6 +53,11 @@ Returns true if some text to be search is pending in the queue
bool isRunning() const;
%Docstring
Returns true if the a search is currently running
%End

void triggerResult( const QModelIndex &index );
%Docstring
Triggers the result at given index
%End

signals:
@@ -37,6 +37,13 @@ bool QgsLocatorModelBridge::isRunning() const
return mIsRunning;
}

void QgsLocatorModelBridge::triggerResult( const QModelIndex &index )
{
mLocator->clearPreviousResults();
QgsLocatorResult result = mProxyModel->data( index, QgsLocatorModel::ResultDataRole ).value< QgsLocatorResult >();
result.filter->triggerResult( result );
}

void QgsLocatorModelBridge::setIsRunning( bool isRunning )
{
if ( mIsRunning == isRunning )
@@ -60,6 +60,9 @@ class CORE_EXPORT QgsLocatorModelBridge : public QObject
//! Returns true if the a search is currently running
bool isRunning() const;

//! Triggers the result at given index
void triggerResult( const QModelIndex &index );

signals:
//! Emitted when a result is added
void resultAdded();
@@ -312,11 +312,9 @@ void QgsLocatorWidget::acceptCurrentEntry()
if ( !index.isValid() )
return;

QgsLocatorResult result = mModelBridge->proxyModel()->data( index, QgsLocatorModel::ResultDataRole ).value< QgsLocatorResult >();
mResultsContainer->hide();
mLineEdit->clearFocus();
mModelBridge->locator()->clearPreviousResults();
result.filter->triggerResult( result );
mModelBridge->triggerResult( index );
}
}

0 comments on commit 31cd164

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