Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 3.12] Fix form filtering when used in feature selection dialog #34822

Merged
merged 1 commit into from
Mar 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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