Skip to content
Permalink
Browse files
Simplify code
  • Loading branch information
nyalldawson committed Nov 25, 2021
1 parent 6000d75 commit ff13ed8925e37c256a209bd149e3ab4b4175e8f9
Showing with 2 additions and 6 deletions.
  1. +2 −6 src/core/project/qgsprojectutils.cpp
@@ -56,13 +56,9 @@ bool QgsProjectUtils::updateLayerPath( QgsProject *project, const QString &oldPa

bool QgsProjectUtils::layerIsContainedInGroupLayer( QgsProject *project, QgsMapLayer *layer )
{
const QMap<QString, QgsMapLayer *> mapLayers( project->mapLayers() );
for ( QgsMapLayer *l : mapLayers )
const QVector< QgsGroupLayer * > groupLayers = project->layers< QgsGroupLayer * >();
for ( QgsGroupLayer *groupLayer : groupLayers )
{
if ( l->type() != QgsMapLayerType::GroupLayer )
continue;

QgsGroupLayer *groupLayer = qobject_cast< QgsGroupLayer * >( l );
if ( groupLayer->childLayers().contains( layer ) )
return true;
}

0 comments on commit ff13ed8

Please sign in to comment.