@@ -87,7 +87,8 @@ bool QgsMapRendererJob::prepareLabelCache() const
8787
8888 // calculate which layers will be labeled
8989 QSet< QgsMapLayer * > labeledLayers;
90- Q_FOREACH ( const QgsMapLayer *ml, mSettings .layers () )
90+ const QList<QgsMapLayer *> layers = mSettings .layers ();
91+ for ( const QgsMapLayer *ml : layers )
9192 {
9293 QgsVectorLayer *vl = const_cast < QgsVectorLayer * >( qobject_cast<const QgsVectorLayer *>( ml ) );
9394 if ( vl && QgsPalLabeling::staticWillUseLayer ( vl ) )
@@ -314,7 +315,7 @@ LayerRenderJobs QgsMapRendererJob::prepareJobs( QPainter *painter, QgsLabelingEn
314315 job.cached = true ;
315316 job.imageInitialized = true ;
316317 job.img = new QImage ( mCache ->cacheImage ( ml->id () ) );
317- job.img ->setDevicePixelRatio ( mSettings .devicePixelRatio () );
318+ job.img ->setDevicePixelRatio ( static_cast <qreal>( mSettings .devicePixelRatio () ) );
318319 job.renderer = nullptr ;
319320 job.context .setPainter ( nullptr );
320321 continue ;
@@ -328,7 +329,7 @@ LayerRenderJobs QgsMapRendererJob::prepareJobs( QPainter *painter, QgsLabelingEn
328329 // Flattened image for drawing when a blending mode is set
329330 QImage *mypFlattenedImage = new QImage ( mSettings .deviceOutputSize (),
330331 mSettings .outputImageFormat () );
331- mypFlattenedImage->setDevicePixelRatio ( mSettings .devicePixelRatio () );
332+ mypFlattenedImage->setDevicePixelRatio ( static_cast <qreal>( mSettings .devicePixelRatio () ) );
332333 if ( mypFlattenedImage->isNull () )
333334 {
334335 mErrors .append ( Error ( ml->id (), tr ( " Insufficient memory for image %1x%2" ).arg ( mSettings .outputSize ().width () ).arg ( mSettings .outputSize ().height () ) ) );
0 commit comments