Skip to content
Permalink
Browse files
Pass list by reference
  • Loading branch information
nyalldawson committed Nov 25, 2021
1 parent 7d54421 commit 82274e89f5205b7fa8a8123b46867febc6c90525
Showing with 4 additions and 5 deletions.
  1. +1 −1 python/core/auto_generated/layertree/qgslayertreenode.sip.in
  2. +2 −3 src/core/layertree/qgslayertreenode.cpp
  3. +1 −1 src/core/layertree/qgslayertreenode.h
@@ -313,7 +313,7 @@ Read common XML elements.
Write common XML elements.
%End

void insertChildrenPrivate( int index, QList<QgsLayerTreeNode *> nodes );
void insertChildrenPrivate( int index, const QList<QgsLayerTreeNode *> &nodes );
%Docstring
Low-level insertion of children to the node. The children must not have any parent yet!
%End
@@ -233,13 +233,12 @@ void QgsLayerTreeNode::writeCommonXml( QDomElement &element )
mProperties.writeXml( element, doc );
}

void QgsLayerTreeNode::insertChildrenPrivate( int index, QList<QgsLayerTreeNode *> nodes )
void QgsLayerTreeNode::insertChildrenPrivate( int index, const QList<QgsLayerTreeNode *> &nodes )
{
if ( nodes.isEmpty() )
return;

const auto constNodes = nodes;
for ( QgsLayerTreeNode *node : constNodes )
for ( QgsLayerTreeNode *node : nodes )
{
Q_ASSERT( !node->mParent );
node->mParent = this;
@@ -285,7 +285,7 @@ class CORE_EXPORT QgsLayerTreeNode : public QObject
void writeCommonXml( QDomElement &element );

//! Low-level insertion of children to the node. The children must not have any parent yet!
void insertChildrenPrivate( int index, QList<QgsLayerTreeNode *> nodes );
void insertChildrenPrivate( int index, const QList<QgsLayerTreeNode *> &nodes );
//! Low-level removal of children from the node.
void removeChildrenPrivate( int from, int count, bool destroy = true );

0 comments on commit 82274e8

Please sign in to comment.