29 : QDialog( parent, Qt::Window )
37 mDualView->setFeatureSelectionManager( mFeatureSelection );
42 mFeatureFilterWidget->init( vl, context, mDualView, mMessageBar, 5 );
43 mFeatureFilterWidget->filterVisible();
45 connect( mActionExpressionSelect, &QAction::triggered,
this, &QgsFeatureSelectionDlg::mActionExpressionSelect_triggered );
46 connect( mActionSelectAll, &QAction::triggered,
this, &QgsFeatureSelectionDlg::mActionSelectAll_triggered );
47 connect( mActionInvertSelection, &QAction::triggered,
this, &QgsFeatureSelectionDlg::mActionInvertSelection_triggered );
48 connect( mActionRemoveSelection, &QAction::triggered,
this, &QgsFeatureSelectionDlg::mActionRemoveSelection_triggered );
50 connect( mActionSelectedToTop, &QAction::toggled,
this, [
this](
bool checked ) { mDualView->setSelectedOnTop( checked ); } );
51 connect( mActionZoomMapToSelectedRows, &QAction::triggered,
this, &QgsFeatureSelectionDlg::mActionZoomMapToSelectedRows_triggered );
52 connect( mActionPanMapToSelectedRows, &QAction::triggered,
this, &QgsFeatureSelectionDlg::mActionPanMapToSelectedRows_triggered );
61 if ( evt->key() == Qt::Key_Enter || evt->key() == Qt::Key_Return )
63 QDialog::keyPressEvent( evt );
68 return mFeatureSelection->selectedFeatureIds();
73 mFeatureSelection->setSelectedFeatures( ids );
79 QWindow *mainWindow =
nullptr;
80 for (
const auto &w : QgsApplication::topLevelWindows() )
82 if ( w->objectName() == QLatin1String(
"QgisAppWindow" ) )
91 const QSize margins( size() - scrollAreaWidgetContents->size() );
92 const QSize innerWinSize( mainWindow->width(), mainWindow->height() );
93 setMaximumSize( innerWinSize );
94 const QSize minSize( scrollAreaWidgetContents->sizeHint() );
95 setMinimumSize( std::min( minSize.width() + margins.width( ), innerWinSize.width() ),
96 std::min( minSize.height() + margins.width( ), innerWinSize.height() ) );
99 QDialog::showEvent( event );
102 void QgsFeatureSelectionDlg::mActionExpressionSelect_triggered()
106 dlg->setAttribute( Qt::WA_DeleteOnClose );
110 void QgsFeatureSelectionDlg::mActionInvertSelection_triggered()
112 mVectorLayer->invertSelection();
115 void QgsFeatureSelectionDlg::mActionRemoveSelection_triggered()
117 mVectorLayer->removeSelection();
120 void QgsFeatureSelectionDlg::mActionSelectAll_triggered()
122 mVectorLayer->selectAll();
125 void QgsFeatureSelectionDlg::mActionZoomMapToSelectedRows_triggered()
127 mContext.mapCanvas()->zoomToSelected( mVectorLayer );
130 void QgsFeatureSelectionDlg::mActionPanMapToSelectedRows_triggered()
132 mContext.mapCanvas()->panToSelected( mVectorLayer );
137 mFeatureFilterWidget->setFilterExpression( filter, type,
true );