Skip to content

Commit c93049a

Browse files
alexbruynyalldawson
authored andcommittedMay 13, 2020
add "Selection" toolbar to the QGIS main window and move all
selection-related actions to it (fix #21045, refs #20350)
1 parent 0fa4718 commit c93049a

File tree

7 files changed

+43
-11
lines changed

7 files changed

+43
-11
lines changed
 

‎python/gui/auto_generated/qgisinterface.sip.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,13 @@ Returns a reference to the main window "Shape Digitizing" toolbar.
300300
virtual QToolBar *attributesToolBar() = 0;
301301
%Docstring
302302
Returns a reference to the main window "Attributes" toolbar.
303+
%End
304+
305+
virtual QToolBar *selectionToolBar() = 0;
306+
%Docstring
307+
Returns a reference to the main window "Selection" toolbar.
308+
309+
.. versionadded:: 3.14
303310
%End
304311

305312
virtual QToolBar *pluginToolBar() = 0;

‎src/app/qgisapp.cpp

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,7 +1050,6 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
10501050
connect( QgsProject::instance(), &QgsProject::collectAttachedFiles, this, &QgisApp::generateProjectAttachedFiles );
10511051
connect( mSnappingUtils, &QgsSnappingUtils::configChanged, QgsProject::instance(), &QgsProject::setSnappingConfig );
10521052

1053-
10541053
endProfile();
10551054

10561055
functionProfile( &QgisApp::createMenus, this, QStringLiteral( "Create menus" ) );
@@ -3129,6 +3128,7 @@ void QgisApp::createToolBars()
31293128
<< mShapeDigitizeToolBar
31303129
<< mMapNavToolBar
31313130
<< mAttributesToolBar
3131+
<< mSelectionToolBar
31323132
<< mPluginToolBar
31333133
<< mHelpToolBar
31343134
<< mRasterToolBar
@@ -3166,7 +3166,7 @@ void QgisApp::createToolBars()
31663166
mToolbarMenu->addActions( toolbarMenuActions );
31673167

31683168
// advanced selection tool button
3169-
QToolButton *bt = new QToolButton( mAttributesToolBar );
3169+
QToolButton *bt = new QToolButton( mSelectionToolBar );
31703170
bt->setPopupMode( QToolButton::MenuButtonPopup );
31713171
bt->addAction( mActionSelectByForm );
31723172
bt->addAction( mActionSelectByExpression );
@@ -3190,13 +3190,12 @@ void QgisApp::createToolBars()
31903190
break;
31913191
}
31923192
bt->setDefaultAction( defAdvancedSelectionAction );
3193-
QAction *advancedSelectionAction = mAttributesToolBar->insertWidget( mActionOpenTable, bt );
3193+
QAction *advancedSelectionAction = mSelectionToolBar->insertWidget( mActionOpenTable, bt );
31943194
advancedSelectionAction->setObjectName( QStringLiteral( "ActionSelection" ) );
31953195
connect( bt, &QToolButton::triggered, this, &QgisApp::toolButtonActionTriggered );
31963196

3197-
31983197
// mouse select tool button
3199-
bt = new QToolButton( mAttributesToolBar );
3198+
bt = new QToolButton( mSelectionToolBar );
32003199
bt->setPopupMode( QToolButton::MenuButtonPopup );
32013200
bt->addAction( mActionSelectFeatures );
32023201
bt->addAction( mActionSelectPolygon );
@@ -3220,13 +3219,12 @@ void QgisApp::createToolBars()
32203219
break;
32213220
}
32223221
bt->setDefaultAction( defMouseSelectAction );
3223-
QAction *mouseSelectionAction = mAttributesToolBar->insertWidget( advancedSelectionAction, bt );
3222+
QAction *mouseSelectionAction = mSelectionToolBar->insertWidget( advancedSelectionAction, bt );
32243223
mouseSelectionAction->setObjectName( QStringLiteral( "ActionSelect" ) );
32253224
connect( bt, &QToolButton::triggered, this, &QgisApp::toolButtonActionTriggered );
32263225

3227-
32283226
// deselection tool button
3229-
bt = new QToolButton( mAttributesToolBar );
3227+
bt = new QToolButton( mSelectionToolBar );
32303228
bt->setPopupMode( QToolButton::MenuButtonPopup );
32313229
bt->addAction( mActionDeselectAll );
32323230
bt->addAction( mActionDeselectActiveLayer );
@@ -3242,13 +3240,11 @@ void QgisApp::createToolBars()
32423240
break;
32433241
}
32443242
bt->setDefaultAction( defDeselectionAction );
3245-
QAction *deselectionAction = mAttributesToolBar->insertWidget( mActionOpenTable, bt );
3243+
QAction *deselectionAction = mSelectionToolBar->insertWidget( mActionOpenTable, bt );
32463244
deselectionAction->setObjectName( QStringLiteral( "ActionDeselection" ) );
32473245
connect( bt, &QToolButton::triggered, this, &QgisApp::toolButtonActionTriggered );
32483246

3249-
32503247
// feature action tool button
3251-
32523248
bt = new QToolButton( mAttributesToolBar );
32533249
bt->setPopupMode( QToolButton::MenuButtonPopup );
32543250
bt->setDefaultAction( mActionFeatureAction );

‎src/app/qgisapp.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,12 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
642642
QToolBar *advancedDigitizeToolBar() { return mAdvancedDigitizeToolBar; }
643643
QToolBar *shapeDigitizeToolBar() { return mShapeDigitizeToolBar; }
644644
QToolBar *attributesToolBar() { return mAttributesToolBar; }
645+
646+
/**
647+
* Returns selection toolbar
648+
* \since QGIS 3.14
649+
*/
650+
QToolBar *selectionToolBar() { return mSelectionToolBar; }
645651
QToolBar *pluginToolBar() { return mPluginToolBar; }
646652
QToolBar *helpToolBar() { return mHelpToolBar; }
647653
QToolBar *rasterToolBar() { return mRasterToolBar; }

‎src/app/qgisappinterface.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,7 @@ QToolBar *QgisAppInterface::digitizeToolBar() { return qgis->digitizeToolBar();
611611
QToolBar *QgisAppInterface::advancedDigitizeToolBar() { return qgis->advancedDigitizeToolBar(); }
612612
QToolBar *QgisAppInterface::shapeDigitizeToolBar() { return qgis->shapeDigitizeToolBar(); }
613613
QToolBar *QgisAppInterface::attributesToolBar() { return qgis->attributesToolBar(); }
614+
QToolBar *QgisAppInterface::selectionToolBar() { return qgis->selectionToolBar(); }
614615
QToolBar *QgisAppInterface::pluginToolBar() { return qgis->pluginToolBar(); }
615616
QToolBar *QgisAppInterface::helpToolBar() { return qgis->helpToolBar(); }
616617
QToolBar *QgisAppInterface::rasterToolBar() { return qgis->rasterToolBar(); }

‎src/app/qgisappinterface.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ class APP_EXPORT QgisAppInterface : public QgisInterface
177177
QToolBar *advancedDigitizeToolBar() override;
178178
QToolBar *shapeDigitizeToolBar() override;
179179
QToolBar *attributesToolBar() override;
180+
QToolBar *selectionToolBar() override;
180181
QToolBar *pluginToolBar() override;
181182
QToolBar *helpToolBar() override;
182183
QToolBar *rasterToolBar() override;

‎src/gui/qgisinterface.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,12 @@ class GUI_EXPORT QgisInterface : public QObject
332332
*/
333333
virtual QToolBar *attributesToolBar() = 0;
334334

335+
/**
336+
* Returns a reference to the main window "Selection" toolbar.
337+
* \since QGIS 3.14
338+
*/
339+
virtual QToolBar *selectionToolBar() = 0;
340+
335341
/**
336342
* Returns a reference to the main window "Plugin" toolbar.
337343
*/

‎src/ui/qgisapp.ui

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,7 @@
705705
<addaction name="mActionNewMemoryLayer"/>
706706
<addaction name="separator"/>
707707
<addaction name="mActionNewVirtualLayer"/>
708+
<addaction name="separator"/>
708709
</widget>
709710
<widget class="QToolBar" name="mShapeDigitizeToolBar">
710711
<property name="windowTitle">
@@ -720,6 +721,20 @@
720721
<bool>false</bool>
721722
</attribute>
722723
</widget>
724+
<widget class="QToolBar" name="mSelectionToolBar">
725+
<property name="windowTitle">
726+
<string>Selection Toolbar</string>
727+
</property>
728+
<property name="toolTip">
729+
<string>Selection Toolbar</string>
730+
</property>
731+
<attribute name="toolBarArea">
732+
<enum>TopToolBarArea</enum>
733+
</attribute>
734+
<attribute name="toolBarBreak">
735+
<bool>false</bool>
736+
</attribute>
737+
</widget>
723738
<action name="mActionNewProject">
724739
<property name="icon">
725740
<iconset resource="../../images/images.qrc">

0 commit comments

Comments
 (0)
Please sign in to comment.