void QgsLayerTreeGroup::insertChildNodes( int index, QList<QgsLayerTreeNode*> nodes ) { // low-level insert insertChildrenPrivate( index, nodes ); updateVisibilityFromChildren(); }
void QgsLayerTreeGroup::insertChildNodes( int index, const QList<QgsLayerTreeNode*>& nodes ) { QgsLayerTreeNode* meChild = nullptr; if ( mMutuallyExclusive && mMutuallyExclusiveChildIndex >= 0 && mMutuallyExclusiveChildIndex < mChildren.count() ) meChild = mChildren.at( mMutuallyExclusiveChildIndex ); // low-level insert insertChildrenPrivate( index, nodes ); if ( mMutuallyExclusive ) { if ( meChild ) { // the child could have change its index - or the new children may have been also set as visible mMutuallyExclusiveChildIndex = mChildren.indexOf( meChild ); } else if ( mChecked == Qt::Checked ) { // we have not picked a child index yet, but we should pick one now // ... so pick the first one from the newly added if ( index == -1 ) index = mChildren.count() - nodes.count(); // get real insertion index mMutuallyExclusiveChildIndex = index; } updateChildVisibilityMutuallyExclusive(); } updateVisibilityFromChildren(); }