Skip to content
Permalink
Browse files
make Group Selected work when only one layer is selected (fix #26211)
  • Loading branch information
alexbruy authored and nyalldawson committed Jan 5, 2022
1 parent fd351df commit f1a196bd885c95ef40bc7df7cc567101566335f0
Showing with 3 additions and 3 deletions.
  1. +1 −1 src/app/qgsapplayertreeviewmenuprovider.cpp
  2. +2 −2 src/gui/layertree/qgslayertreeviewdefaultactions.cpp
@@ -131,7 +131,7 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu()

menu->addSeparator();

if ( mView->selectedNodes( true ).count() >= 2 )
if ( mView->selectedNodes( true ).count() >= 1 )
menu->addAction( actions->actionGroupSelected( menu ) );

if ( QgisApp::instance()->clipboard()->hasFormat( QGSCLIPBOARD_STYLE_MIME ) )
@@ -240,7 +240,7 @@ void QgsLayerTreeViewDefaultActions::checkAndAllParents()

void QgsLayerTreeViewDefaultActions::addGroup()
{
if ( mView->selectedNodes( true ).count() >= 2 )
if ( mView->selectedNodes( true ).count() >= 1 )
{
groupSelected();
return;
@@ -511,7 +511,7 @@ void QgsLayerTreeViewDefaultActions::moveToBottom()
void QgsLayerTreeViewDefaultActions::groupSelected()
{
const QList<QgsLayerTreeNode *> nodes = mView->selectedNodes( true );
if ( nodes.count() < 2 || ! QgsLayerTree::isGroup( nodes[0]->parent() ) )
if ( nodes.count() < 1 || ! QgsLayerTree::isGroup( nodes[0]->parent() ) )
return;

QgsLayerTreeGroup *parentGroup = QgsLayerTree::toGroup( nodes[0]->parent() );

0 comments on commit f1a196b

Please sign in to comment.