@@ -332,23 +332,36 @@ void QgsComposerMap::paint( QPainter *painter, const QStyleOptionGraphicsItem *,
332332 {
333333 if ( !mCacheFinalImage || mCacheFinalImage ->isNull () )
334334 {
335+ // No initial render available - so draw some preview text alerting user
336+ drawBackground ( painter );
337+ painter->setBrush ( QBrush ( QColor ( 125 , 125 , 125 , 125 ) ) );
338+ painter->drawRect ( thisPaintRect );
339+ painter->setBrush ( Qt::NoBrush );
340+ QFont messageFont;
341+ messageFont.setPointSize ( 12 );
342+ painter->setFont ( messageFont );
343+ painter->setPen ( QColor ( 255 , 255 , 255 , 255 ) );
344+ painter->drawText ( thisPaintRect, Qt::AlignCenter | Qt::AlignHCenter, tr ( " Rendering map" ) );
345+
346+
335347 cache ();
336- return ;
337348 }
349+ else
350+ {
351+ // Background color is already included in cached image, so no need to draw
338352
339- // Background color is already included in cached image, so no need to draw
340-
341- double imagePixelWidth = mCacheFinalImage ->width (); // how many pixels of the image are for the map extent?
342- double scale = rect ().width () / imagePixelWidth;
353+ double imagePixelWidth = mCacheFinalImage ->width (); // how many pixels of the image are for the map extent?
354+ double scale = rect ().width () / imagePixelWidth;
343355
344- painter->save ();
356+ painter->save ();
345357
346- painter->translate ( mLastRenderedImageOffsetX + mXOffset , mLastRenderedImageOffsetY + mYOffset );
347- painter->scale ( scale, scale );
348- painter->drawImage ( 0 , 0 , *mCacheFinalImage );
358+ painter->translate ( mLastRenderedImageOffsetX + mXOffset , mLastRenderedImageOffsetY + mYOffset );
359+ painter->scale ( scale, scale );
360+ painter->drawImage ( 0 , 0 , *mCacheFinalImage );
349361
350- // restore rotation
351- painter->restore ();
362+ // restore rotation
363+ painter->restore ();
364+ }
352365 }
353366 else if ( mComposition ->plotStyle () == QgsComposition::Print ||
354367 mComposition ->plotStyle () == QgsComposition::Postscript )
0 commit comments