Skip to content

Commit

Permalink
Pass list by reference
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Nov 25, 2021
1 parent 7d54421 commit 82274e8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions src/core/layertree/qgslayertreenode.cpp
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/core/layertree/qgslayertreenode.h
Expand Up @@ -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 );

Expand Down

0 comments on commit 82274e8

Please sign in to comment.