diff --git a/src/gui/qgsfeatureselectiondlg.cpp b/src/gui/qgsfeatureselectiondlg.cpp index 4f61ee5de27a..d794f0a5ccc1 100644 --- a/src/gui/qgsfeatureselectiondlg.cpp +++ b/src/gui/qgsfeatureselectiondlg.cpp @@ -50,6 +50,9 @@ QgsFeatureSelectionDlg::QgsFeatureSelectionDlg( QgsVectorLayer *vl, const QgsAtt connect( mActionSelectedToTop, &QAction::toggled, this, [this]( bool checked ) { mDualView->setSelectedOnTop( checked ); } ); connect( mActionZoomMapToSelectedRows, &QAction::triggered, this, &QgsFeatureSelectionDlg::mActionZoomMapToSelectedRows_triggered ); connect( mActionPanMapToSelectedRows, &QAction::triggered, this, &QgsFeatureSelectionDlg::mActionPanMapToSelectedRows_triggered ); + + connect( mDualView, &QgsDualView::filterExpressionSet, this, &QgsFeatureSelectionDlg::setFilterExpression ); + connect( mDualView, &QgsDualView::formModeChanged, this, &QgsFeatureSelectionDlg::viewModeChanged ); } void QgsFeatureSelectionDlg::keyPressEvent( QKeyEvent *evt ) @@ -128,3 +131,13 @@ void QgsFeatureSelectionDlg::mActionPanMapToSelectedRows_triggered() { mContext.mapCanvas()->panToSelected( mVectorLayer ); } + +void QgsFeatureSelectionDlg::setFilterExpression( const QString &filter, QgsAttributeForm::FilterType type ) +{ + mFeatureFilterWidget->setFilterExpression( filter, type, true ); +} + +void QgsFeatureSelectionDlg::viewModeChanged( QgsAttributeEditorContext::Mode mode ) +{ + mActionSearchForm->setChecked( mode == QgsAttributeEditorContext::SearchMode ); +} diff --git a/src/gui/qgsfeatureselectiondlg.h b/src/gui/qgsfeatureselectiondlg.h index a53404bc0037..f1bce951efc1 100644 --- a/src/gui/qgsfeatureselectiondlg.h +++ b/src/gui/qgsfeatureselectiondlg.h @@ -105,6 +105,16 @@ class GUI_EXPORT QgsFeatureSelectionDlg : public QDialog, private Ui::QgsFeature */ void mActionExpressionSelect_triggered(); + /** + * Set form filter expression + */ + void setFilterExpression( const QString &filter, QgsAttributeForm::FilterType type ); + + /** + * View mode has changed + */ + void viewModeChanged( QgsAttributeEditorContext::Mode mode ); + private: QgsVectorLayerSelectionManager *mFeatureSelection = nullptr;