Skip to content

Commit

Permalink
Merge pull request #34822 from troopa81/backport_34336_to_release-3_12
Browse files Browse the repository at this point in the history
[Backport 3.12] Fix form filtering when used in feature selection dialog
  • Loading branch information
rouault committed Mar 11, 2020
2 parents 6000739 + bcd401d commit d5aaf85
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/gui/qgsfeatureselectiondlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down Expand Up @@ -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 );
}
10 changes: 10 additions & 0 deletions src/gui/qgsfeatureselectiondlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d5aaf85

Please sign in to comment.