Skip to content

Commit 02b78a9

Browse files
committedJan 3, 2017
Make click on a unchecked layer in the tree view check all its parents.
This removes the Ctrl+clic requirement added initially.
1 parent 60a1701 commit 02b78a9

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed
 

‎src/core/layertree/qgslayertreemodel.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,11 @@ bool QgsLayerTreeModel::setData( const QModelIndex& index, const QVariant& value
394394
return false;
395395

396396
bool checked = static_cast< Qt::CheckState >( value.toInt() ) == Qt::Checked;
397-
if ( testFlag( ActionHierarchical ) )
397+
if ( checked && node->children().isEmpty() )
398+
{
399+
node->setItemVisibilityCheckedParentRecursive( checked );
400+
}
401+
else if ( testFlag( ActionHierarchical ) )
398402
{
399403
if ( node->children().isEmpty() )
400404
node->setItemVisibilityCheckedParentRecursive( checked );

‎src/gui/layertree/qgslayertreeviewdefaultactions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ QAction* QgsLayerTreeViewDefaultActions::actionCheckAndAllParents( QObject* pare
148148
QgsLayerTreeNode* node = mView->currentNode();
149149
if ( !node || !QgsLayerTree::isLayer( node ) || node->isVisible() )
150150
return nullptr;
151-
QAction* a = new QAction( tr( "Check and all its parents (Ctrl-click)" ), parent );
151+
QAction* a = new QAction( tr( "Check and all its parents" ), parent );
152152
connect( a, &QAction::triggered, this, &QgsLayerTreeViewDefaultActions::checkAndAllParents );
153153
return a;
154154
}

0 commit comments

Comments
 (0)
Please sign in to comment.