@@ -3800,45 +3800,35 @@ void QgsComposer::setSelectionTool()
38003800
38013801bool QgsComposer::containsWmsLayer () const
38023802{
3803- QMap<QgsComposerItem*, QgsPanelWidget*>::const_iterator item_it = mItemWidgetMap .constBegin ();
3804- QgsComposerItem* currentItem = nullptr ;
3805- QgsComposerMap* currentMap = nullptr ;
3803+ QList< QgsComposerMap *> maps;
3804+ mComposition ->composerItems ( maps );
38063805
3807- for ( ; item_it != mItemWidgetMap . constEnd (); ++item_it )
3806+ Q_FOREACH ( QgsComposerMap* map, maps )
38083807 {
3809- currentItem = item_it.key ();
3810- currentMap = dynamic_cast <QgsComposerMap *>( currentItem );
3811- if ( currentMap )
3812- {
3813- if ( currentMap->containsWmsLayer () )
3814- {
3815- return true ;
3816- }
3817- }
3808+ if ( map->containsWmsLayer () )
3809+ return true ;
38183810 }
38193811 return false ;
38203812}
38213813
38223814bool QgsComposer::containsAdvancedEffects () const
38233815{
3824- // Check if composer contains any blend modes or flattened layers for transparency
3825- QMap<QgsComposerItem*, QgsPanelWidget*>::const_iterator item_it = mItemWidgetMap .constBegin ();
3826- QgsComposerItem* currentItem = nullptr ;
3827- QgsComposerMap* currentMap = nullptr ;
3816+ QList< QgsComposerItem *> items;
3817+ mComposition ->composerItems ( items );
38283818
3829- for ( ; item_it != mItemWidgetMap . constEnd (); ++item_it )
3819+ Q_FOREACH ( QgsComposerItem* currentItem, items )
38303820 {
3831- currentItem = item_it.key ();
38323821 // Check composer item's blend mode
38333822 if ( currentItem->blendMode () != QPainter::CompositionMode_SourceOver )
38343823 {
38353824 return true ;
38363825 }
3826+
38373827 // If item is a composer map, check if it contains any advanced effects
3838- currentMap = dynamic_cast <QgsComposerMap *>( currentItem );
3839- if ( currentMap && currentMap->containsAdvancedEffects () )
3828+ if ( QgsComposerMap * currentMap = dynamic_cast <QgsComposerMap *>( currentItem ) )
38403829 {
3841- return true ;
3830+ if ( currentMap->containsAdvancedEffects () )
3831+ return true ;
38423832 }
38433833 }
38443834 return false ;
0 commit comments