Skip to content

Commit 31cd164

Browse files
committedNov 9, 2018
also move triggering of results to core
1 parent dd14e58 commit 31cd164

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed
 

‎python/core/auto_generated/locator/qgslocatormodelbridge.sip.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ Returns true if some text to be search is pending in the queue
5353
bool isRunning() const;
5454
%Docstring
5555
Returns true if the a search is currently running
56+
%End
57+
58+
void triggerResult( const QModelIndex &index );
59+
%Docstring
60+
Triggers the result at given index
5661
%End
5762

5863
signals:

‎src/core/locator/qgslocatormodelbridge.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ bool QgsLocatorModelBridge::isRunning() const
3737
return mIsRunning;
3838
}
3939

40+
void QgsLocatorModelBridge::triggerResult( const QModelIndex &index )
41+
{
42+
mLocator->clearPreviousResults();
43+
QgsLocatorResult result = mProxyModel->data( index, QgsLocatorModel::ResultDataRole ).value< QgsLocatorResult >();
44+
result.filter->triggerResult( result );
45+
}
46+
4047
void QgsLocatorModelBridge::setIsRunning( bool isRunning )
4148
{
4249
if ( mIsRunning == isRunning )

‎src/core/locator/qgslocatormodelbridge.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ class CORE_EXPORT QgsLocatorModelBridge : public QObject
6060
//! Returns true if the a search is currently running
6161
bool isRunning() const;
6262

63+
//! Triggers the result at given index
64+
void triggerResult( const QModelIndex &index );
65+
6366
signals:
6467
//! Emitted when a result is added
6568
void resultAdded();

‎src/gui/locator/qgslocatorwidget.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,11 +312,9 @@ void QgsLocatorWidget::acceptCurrentEntry()
312312
if ( !index.isValid() )
313313
return;
314314

315-
QgsLocatorResult result = mModelBridge->proxyModel()->data( index, QgsLocatorModel::ResultDataRole ).value< QgsLocatorResult >();
316315
mResultsContainer->hide();
317316
mLineEdit->clearFocus();
318-
mModelBridge->locator()->clearPreviousResults();
319-
result.filter->triggerResult( result );
317+
mModelBridge->triggerResult( index );
320318
}
321319
}
322320

0 commit comments

Comments
 (0)
Please sign in to comment.