mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-08 00:05:09 -04:00
Make click on a unchecked layer in the tree view check all its parents.
This removes the Ctrl+clic requirement added initially.
This commit is contained in:
parent
60a1701377
commit
02b78a96f6
@ -394,7 +394,11 @@ bool QgsLayerTreeModel::setData( const QModelIndex& index, const QVariant& value
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool checked = static_cast< Qt::CheckState >( value.toInt() ) == Qt::Checked;
|
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() )
|
if ( node->children().isEmpty() )
|
||||||
node->setItemVisibilityCheckedParentRecursive( checked );
|
node->setItemVisibilityCheckedParentRecursive( checked );
|
||||||
|
@ -148,7 +148,7 @@ QAction* QgsLayerTreeViewDefaultActions::actionCheckAndAllParents( QObject* pare
|
|||||||
QgsLayerTreeNode* node = mView->currentNode();
|
QgsLayerTreeNode* node = mView->currentNode();
|
||||||
if ( !node || !QgsLayerTree::isLayer( node ) || node->isVisible() )
|
if ( !node || !QgsLayerTree::isLayer( node ) || node->isVisible() )
|
||||||
return nullptr;
|
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 );
|
connect( a, &QAction::triggered, this, &QgsLayerTreeViewDefaultActions::checkAndAllParents );
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user