Skip to content
Permalink
Browse files

Make click on a unchecked layer in the tree view check all its parents.

This removes the Ctrl+clic requirement added initially.
  • Loading branch information
rouault committed Jan 3, 2017
1 parent 60a1701 commit 02b78a96f6e7ab6f2d589e8cae1d64fc9b93d811
@@ -394,7 +394,11 @@ bool QgsLayerTreeModel::setData( const QModelIndex& index, const QVariant& value
return false;

bool checked = static_cast< Qt::CheckState >( value.toInt() ) == Qt::Checked;
if ( testFlag( ActionHierarchical ) )
if ( checked && node->children().isEmpty() )
{
node->setItemVisibilityCheckedParentRecursive( checked );
}
else if ( testFlag( ActionHierarchical ) )
{
if ( node->children().isEmpty() )
node->setItemVisibilityCheckedParentRecursive( checked );
@@ -148,7 +148,7 @@ QAction* QgsLayerTreeViewDefaultActions::actionCheckAndAllParents( QObject* pare
QgsLayerTreeNode* node = mView->currentNode();
if ( !node || !QgsLayerTree::isLayer( node ) || node->isVisible() )
return nullptr;
QAction* a = new QAction( tr( "Check and all its parents (Ctrl-click)" ), parent );
QAction* a = new QAction( tr( "Check and all its parents" ), parent );
connect( a, &QAction::triggered, this, &QgsLayerTreeViewDefaultActions::checkAndAllParents );
return a;
}

0 comments on commit 02b78a9

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