|
210 | 210 | #include "qgsrectangle.h"
|
211 | 211 | #include "qgsscalevisibilitydialog.h"
|
212 | 212 | #include "qgsgroupwmsdatadialog.h"
|
| 213 | +#include "qgsselectbyformdialog.h" |
213 | 214 | #include "qgsshortcutsmanager.h"
|
214 | 215 | #include "qgssinglebandgrayrenderer.h"
|
215 | 216 | #include "qgssnappingdialog.h"
|
@@ -1514,6 +1515,7 @@ void QgisApp::createActions()
|
1514 | 1515 | connect( mActionSelectAll, SIGNAL( triggered() ), this, SLOT( selectAll() ) );
|
1515 | 1516 | connect( mActionInvertSelection, SIGNAL( triggered() ), this, SLOT( invertSelection() ) );
|
1516 | 1517 | connect( mActionSelectByExpression, SIGNAL( triggered() ), this, SLOT( selectByExpression() ) );
|
| 1518 | + connect( mActionSelectByForm, SIGNAL( triggered() ), this, SLOT( selectByForm() ) ); |
1517 | 1519 | connect( mActionIdentify, SIGNAL( triggered() ), this, SLOT( identify() ) );
|
1518 | 1520 | connect( mActionFeatureAction, SIGNAL( triggered() ), this, SLOT( doFeatureAction() ) );
|
1519 | 1521 | connect( mActionMeasure, SIGNAL( triggered() ), this, SLOT( measure() ) );
|
@@ -1988,7 +1990,7 @@ void QgisApp::createToolBars()
|
1988 | 1990 | QToolButton *bt = new QToolButton( mAttributesToolBar );
|
1989 | 1991 | bt->setPopupMode( QToolButton::MenuButtonPopup );
|
1990 | 1992 | QList<QAction*> selectActions;
|
1991 |
| - selectActions << mActionSelectByExpression << mActionSelectAll |
| 1993 | + selectActions << mActionSelectByExpression << mActionSelectByForm << mActionSelectAll |
1992 | 1994 | << mActionInvertSelection;
|
1993 | 1995 | bt->addActions( selectActions );
|
1994 | 1996 | bt->setDefaultAction( mActionSelectByExpression );
|
@@ -2550,6 +2552,7 @@ void QgisApp::setTheme( const QString& theThemeName )
|
2550 | 2552 | mActionSelectAll->setIcon( QgsApplication::getThemeIcon( "/mActionSelectAll.svg" ) );
|
2551 | 2553 | mActionInvertSelection->setIcon( QgsApplication::getThemeIcon( "/mActionInvertSelection.svg" ) );
|
2552 | 2554 | mActionSelectByExpression->setIcon( QgsApplication::getThemeIcon( "/mIconExpressionSelect.svg" ) );
|
| 2555 | + mActionSelectByForm->setIcon( QgsApplication::getThemeIcon( "/mIconFormSelect.svg" ) ); |
2553 | 2556 | mActionOpenTable->setIcon( QgsApplication::getThemeIcon( "/mActionOpenTable.svg" ) );
|
2554 | 2557 | mActionOpenFieldCalc->setIcon( QgsApplication::getThemeIcon( "/mActionCalculateField.png" ) );
|
2555 | 2558 | mActionMeasure->setIcon( QgsApplication::getThemeIcon( "/mActionMeasure.png" ) );
|
@@ -7211,6 +7214,34 @@ void QgisApp::selectByExpression()
|
7211 | 7214 | dlg->show();
|
7212 | 7215 | }
|
7213 | 7216 |
|
| 7217 | +void QgisApp::selectByForm() |
| 7218 | +{ |
| 7219 | + QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( mMapCanvas->currentLayer() ); |
| 7220 | + if ( !vlayer ) |
| 7221 | + { |
| 7222 | + messageBar()->pushMessage( |
| 7223 | + tr( "No active vector layer" ), |
| 7224 | + tr( "To select features, choose a vector layer in the legend" ), |
| 7225 | + QgsMessageBar::INFO, |
| 7226 | + messageTimeout() ); |
| 7227 | + return; |
| 7228 | + } |
| 7229 | + QgsDistanceArea myDa; |
| 7230 | + |
| 7231 | + myDa.setSourceCrs( vlayer->crs().srsid() ); |
| 7232 | + myDa.setEllipsoidalMode( mMapCanvas->mapSettings().hasCrsTransformEnabled() ); |
| 7233 | + myDa.setEllipsoid( QgsProject::instance()->readEntry( "Measure", "/Ellipsoid", GEO_NONE ) ); |
| 7234 | + |
| 7235 | + QgsAttributeEditorContext context; |
| 7236 | + context.setDistanceArea( myDa ); |
| 7237 | + context.setVectorLayerTools( mVectorLayerTools ); |
| 7238 | + |
| 7239 | + QgsSelectByFormDialog* dlg = new QgsSelectByFormDialog( vlayer, context, this ); |
| 7240 | + dlg->setMessageBar( messageBar() ); |
| 7241 | + dlg->setAttribute( Qt::WA_DeleteOnClose ); |
| 7242 | + dlg->show(); |
| 7243 | +} |
| 7244 | + |
7214 | 7245 | void QgisApp::addRing()
|
7215 | 7246 | {
|
7216 | 7247 | mMapCanvas->setMapTool( mMapTools.mAddRing );
|
@@ -10315,6 +10346,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
|
10315 | 10346 | mActionSelectRadius->setEnabled( false );
|
10316 | 10347 | mActionIdentify->setEnabled( QSettings().value( "/Map/identifyMode", 0 ).toInt() != 0 );
|
10317 | 10348 | mActionSelectByExpression->setEnabled( false );
|
| 10349 | + mActionSelectByForm->setEnabled( false ); |
10318 | 10350 | mActionLabeling->setEnabled( false );
|
10319 | 10351 | mActionOpenTable->setEnabled( false );
|
10320 | 10352 | mActionSelectAll->setEnabled( false );
|
@@ -10419,6 +10451,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
|
10419 | 10451 | mActionSelectRadius->setEnabled( true );
|
10420 | 10452 | mActionIdentify->setEnabled( true );
|
10421 | 10453 | mActionSelectByExpression->setEnabled( true );
|
| 10454 | + mActionSelectByForm->setEnabled( true ); |
10422 | 10455 | mActionOpenTable->setEnabled( true );
|
10423 | 10456 | mActionSelectAll->setEnabled( true );
|
10424 | 10457 | mActionInvertSelection->setEnabled( true );
|
@@ -10606,6 +10639,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
|
10606 | 10639 | mActionSelectAll->setEnabled( false );
|
10607 | 10640 | mActionInvertSelection->setEnabled( false );
|
10608 | 10641 | mActionSelectByExpression->setEnabled( false );
|
| 10642 | + mActionSelectByForm->setEnabled( false ); |
10609 | 10643 | mActionOpenFieldCalc->setEnabled( false );
|
10610 | 10644 | mActionToggleEditing->setEnabled( false );
|
10611 | 10645 | mActionToggleEditing->setChecked( false );
|
|
0 commit comments