Skip to content

Commit

Permalink
Make click on a unchecked layer in the tree view check all its parents.
Browse files Browse the repository at this point in the history
This removes the Ctrl+clic requirement added initially.
  • Loading branch information
rouault committed Jan 3, 2017
1 parent 60a1701 commit 02b78a9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/core/layertree/qgslayertreemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
2 changes: 1 addition & 1 deletion src/gui/layertree/qgslayertreeviewdefaultactions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 02b78a9

Please sign in to comment.