Skip to content

Commit

Permalink
Merge pull request #5286 from DelazJ/toolswitch
Browse files Browse the repository at this point in the history
 Enable display of selection tools in Attribute toolbar
  • Loading branch information
nyalldawson authored Oct 26, 2017
2 parents 089fa36 + 2d71419 commit 4021c30
Showing 1 changed file with 35 additions and 10 deletions.
45 changes: 35 additions & 10 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() )
Expand Down Expand Up @@ -2465,7 +2483,6 @@ void QgisApp::createToolBars()
case 4:
defAnnotationAction = mActionAnnotation;
break;

}
bt->setDefaultAction( defAnnotationAction );
QAction *annotationAction = mAttributesToolBar->addWidget( bt );
Expand Down Expand Up @@ -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 )
Expand Down

0 comments on commit 4021c30

Please sign in to comment.