Skip to content
Permalink
Browse files

Merge pull request #5286 from DelazJ/toolswitch

 Enable display of selection tools in Attribute toolbar
  • Loading branch information
nyalldawson committed Oct 26, 2017
2 parents 089fa36 + 2d71419 commit 4021c300051d0a1480985eee5a0ece25f4a3e69d
Showing with 35 additions and 10 deletions.
  1. +35 −10 src/app/qgisapp.cpp
@@ -2360,22 +2360,40 @@ void QgisApp::createToolBars()

QToolButton *bt = new QToolButton( mAttributesToolBar );
bt->setPopupMode( QToolButton::MenuButtonPopup );
QList<QAction *> selectActions;
selectActions << mActionSelectByForm << mActionSelectByExpression << mActionSelectAll
<< mActionInvertSelection;
bt->addActions( selectActions );
bt->setDefaultAction( mActionSelectByForm );
QList<QAction *> selectionActions;
selectionActions << mActionSelectByForm << mActionSelectByExpression << mActionSelectAll
<< mActionInvertSelection;
bt->addActions( selectionActions );

QAction *defSelectionAction = mActionSelectByForm;
switch ( settings.value( QStringLiteral( "UI/selectionTool" ), 0 ).toInt() )
{
case 0:
defSelectionAction = mActionSelectByForm;
break;
case 1:
defSelectionAction = mActionSelectByExpression;
break;
case 2:
defSelectionAction = mActionSelectAll;
break;
case 3:
defSelectionAction = mActionInvertSelection;
break;
}
bt->setDefaultAction( defSelectionAction );
QAction *selectionAction = mAttributesToolBar->insertWidget( mActionDeselectAll, bt );
selectionAction->setObjectName( QStringLiteral( "ActionSelection" ) );
connect( bt, &QToolButton::triggered, this, &QgisApp::toolButtonActionTriggered );

// select tool button

bt = new QToolButton( mAttributesToolBar );
bt->setPopupMode( QToolButton::MenuButtonPopup );
QList<QAction *> selectionActions;
selectionActions << mActionSelectFeatures << mActionSelectPolygon
<< mActionSelectFreehand << mActionSelectRadius;
bt->addActions( selectionActions );
QList<QAction *> selectActions;
selectActions << mActionSelectFeatures << mActionSelectPolygon
<< mActionSelectFreehand << mActionSelectRadius;
bt->addActions( selectActions );

QAction *defSelectAction = mActionSelectFeatures;
switch ( settings.value( QStringLiteral( "UI/selectTool" ), 1 ).toInt() )
@@ -2465,7 +2483,6 @@ void QgisApp::createToolBars()
case 4:
defAnnotationAction = mActionAnnotation;
break;

}
bt->setDefaultAction( defAnnotationAction );
QAction *annotationAction = mAttributesToolBar->addWidget( bt );
@@ -12770,6 +12787,14 @@ void QgisApp::toolButtonActionTriggered( QAction *action )
settings.setValue( QStringLiteral( "UI/selectTool" ), 3 );
else if ( action == mActionSelectFreehand )
settings.setValue( QStringLiteral( "UI/selectTool" ), 4 );
else if ( action == mActionSelectByForm )
settings.setValue( QStringLiteral( "UI/selectionTool" ), 0 );
else if ( action == mActionSelectByExpression )
settings.setValue( QStringLiteral( "UI/selectionTool" ), 1 );
else if ( action == mActionSelectAll )
settings.setValue( QStringLiteral( "UI/selectionTool" ), 2 );
else if ( action == mActionInvertSelection )
settings.setValue( QStringLiteral( "UI/selectionTool" ), 3 );
else if ( action == mActionMeasure )
settings.setValue( QStringLiteral( "UI/measureTool" ), 0 );
else if ( action == mActionMeasureArea )

0 comments on commit 4021c30

Please sign in to comment.
You can’t perform that action at this time.