Skip to content
Permalink
Browse files

add "Selection" toolbar to the QGIS main window and move all

selection-related actions to it (fix #21045, refs #20350)
  • Loading branch information
alexbruy authored and nyalldawson committed May 7, 2020
1 parent 0fa4718 commit c93049afd19ced6fe5064aefd0449e750c89a2c4
@@ -300,6 +300,13 @@ Returns a reference to the main window "Shape Digitizing" toolbar.
virtual QToolBar *attributesToolBar() = 0;
%Docstring
Returns a reference to the main window "Attributes" toolbar.
%End

virtual QToolBar *selectionToolBar() = 0;
%Docstring
Returns a reference to the main window "Selection" toolbar.

.. versionadded:: 3.14
%End

virtual QToolBar *pluginToolBar() = 0;
@@ -1050,7 +1050,6 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
connect( QgsProject::instance(), &QgsProject::collectAttachedFiles, this, &QgisApp::generateProjectAttachedFiles );
connect( mSnappingUtils, &QgsSnappingUtils::configChanged, QgsProject::instance(), &QgsProject::setSnappingConfig );


endProfile();

functionProfile( &QgisApp::createMenus, this, QStringLiteral( "Create menus" ) );
@@ -3129,6 +3128,7 @@ void QgisApp::createToolBars()
<< mShapeDigitizeToolBar
<< mMapNavToolBar
<< mAttributesToolBar
<< mSelectionToolBar
<< mPluginToolBar
<< mHelpToolBar
<< mRasterToolBar
@@ -3166,7 +3166,7 @@ void QgisApp::createToolBars()
mToolbarMenu->addActions( toolbarMenuActions );

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


// mouse select tool button
bt = new QToolButton( mAttributesToolBar );
bt = new QToolButton( mSelectionToolBar );
bt->setPopupMode( QToolButton::MenuButtonPopup );
bt->addAction( mActionSelectFeatures );
bt->addAction( mActionSelectPolygon );
@@ -3220,13 +3219,12 @@ void QgisApp::createToolBars()
break;
}
bt->setDefaultAction( defMouseSelectAction );
QAction *mouseSelectionAction = mAttributesToolBar->insertWidget( advancedSelectionAction, bt );
QAction *mouseSelectionAction = mSelectionToolBar->insertWidget( advancedSelectionAction, bt );
mouseSelectionAction->setObjectName( QStringLiteral( "ActionSelect" ) );
connect( bt, &QToolButton::triggered, this, &QgisApp::toolButtonActionTriggered );


// deselection tool button
bt = new QToolButton( mAttributesToolBar );
bt = new QToolButton( mSelectionToolBar );
bt->setPopupMode( QToolButton::MenuButtonPopup );
bt->addAction( mActionDeselectAll );
bt->addAction( mActionDeselectActiveLayer );
@@ -3242,13 +3240,11 @@ void QgisApp::createToolBars()
break;
}
bt->setDefaultAction( defDeselectionAction );
QAction *deselectionAction = mAttributesToolBar->insertWidget( mActionOpenTable, bt );
QAction *deselectionAction = mSelectionToolBar->insertWidget( mActionOpenTable, bt );
deselectionAction->setObjectName( QStringLiteral( "ActionDeselection" ) );
connect( bt, &QToolButton::triggered, this, &QgisApp::toolButtonActionTriggered );


// feature action tool button

bt = new QToolButton( mAttributesToolBar );
bt->setPopupMode( QToolButton::MenuButtonPopup );
bt->setDefaultAction( mActionFeatureAction );
@@ -642,6 +642,12 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
QToolBar *advancedDigitizeToolBar() { return mAdvancedDigitizeToolBar; }
QToolBar *shapeDigitizeToolBar() { return mShapeDigitizeToolBar; }
QToolBar *attributesToolBar() { return mAttributesToolBar; }

/**
* Returns selection toolbar
* \since QGIS 3.14
*/
QToolBar *selectionToolBar() { return mSelectionToolBar; }
QToolBar *pluginToolBar() { return mPluginToolBar; }
QToolBar *helpToolBar() { return mHelpToolBar; }
QToolBar *rasterToolBar() { return mRasterToolBar; }
@@ -611,6 +611,7 @@ QToolBar *QgisAppInterface::digitizeToolBar() { return qgis->digitizeToolBar();
QToolBar *QgisAppInterface::advancedDigitizeToolBar() { return qgis->advancedDigitizeToolBar(); }
QToolBar *QgisAppInterface::shapeDigitizeToolBar() { return qgis->shapeDigitizeToolBar(); }
QToolBar *QgisAppInterface::attributesToolBar() { return qgis->attributesToolBar(); }
QToolBar *QgisAppInterface::selectionToolBar() { return qgis->selectionToolBar(); }
QToolBar *QgisAppInterface::pluginToolBar() { return qgis->pluginToolBar(); }
QToolBar *QgisAppInterface::helpToolBar() { return qgis->helpToolBar(); }
QToolBar *QgisAppInterface::rasterToolBar() { return qgis->rasterToolBar(); }
@@ -177,6 +177,7 @@ class APP_EXPORT QgisAppInterface : public QgisInterface
QToolBar *advancedDigitizeToolBar() override;
QToolBar *shapeDigitizeToolBar() override;
QToolBar *attributesToolBar() override;
QToolBar *selectionToolBar() override;
QToolBar *pluginToolBar() override;
QToolBar *helpToolBar() override;
QToolBar *rasterToolBar() override;
@@ -332,6 +332,12 @@ class GUI_EXPORT QgisInterface : public QObject
*/
virtual QToolBar *attributesToolBar() = 0;

/**
* Returns a reference to the main window "Selection" toolbar.
* \since QGIS 3.14
*/
virtual QToolBar *selectionToolBar() = 0;

/**
* Returns a reference to the main window "Plugin" toolbar.
*/
@@ -705,6 +705,7 @@
<addaction name="mActionNewMemoryLayer"/>
<addaction name="separator"/>
<addaction name="mActionNewVirtualLayer"/>
<addaction name="separator"/>
</widget>
<widget class="QToolBar" name="mShapeDigitizeToolBar">
<property name="windowTitle">
@@ -720,6 +721,20 @@
<bool>false</bool>
</attribute>
</widget>
<widget class="QToolBar" name="mSelectionToolBar">
<property name="windowTitle">
<string>Selection Toolbar</string>
</property>
<property name="toolTip">
<string>Selection Toolbar</string>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<action name="mActionNewProject">
<property name="icon">
<iconset resource="../../images/images.qrc">

0 comments on commit c93049a

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