Merge pull request #34336 from troopa81/fix_formfilter_featureselectiondlg

Fix form filtering when used in feature selection dialog
This commit is contained in:
Matthias Kuhn 2020-02-28 08:45:54 +01:00 committed by GitHub
commit 0a9bbd724f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 0 deletions

View File

@ -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 );
}

View File

@ -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;