Skip to content

Commit 591bb75

Browse files
committed
[layouts] Fix first background map render can never be canceled
and must always complete This fixes an issue where map items appear to get "stuck" showing the "Rendering map" text while the very first render of the map item completes. If the map render is lengthy (e.g. due to complex labeling and an initially too small map scale), then it can appear as if the map item has got stuck. Instead, we now correctly support cancelation of this initial map render job, just like we do subsequent ones.
1 parent 6d34089 commit 591bb75

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/core/layout/qgslayoutitemmap.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,13 @@ void QgsLayoutItemMap::paint( QPainter *painter, const QStyleOptionGraphicsItem
778778
painter->setFont( messageFont );
779779
painter->setPen( QColor( 255, 255, 255, 255 ) );
780780
painter->drawText( thisPaintRect, Qt::AlignCenter | Qt::AlignHCenter, tr( "Rendering map" ) );
781-
if ( !mPainterJob && !mDrawingPreview )
781+
if ( mPainterJob && mCacheInvalidated && !mDrawingPreview )
782+
{
783+
// current job was invalidated - start a new one
784+
mPreviewScaleFactor = QgsLayoutUtils::scaleFactorFromItemStyle( style );
785+
mBackgroundUpdateTimer->start( 1 );
786+
}
787+
else if ( !mPainterJob && !mDrawingPreview )
782788
{
783789
// this is the map's very first paint - trigger a cache update
784790
mPreviewScaleFactor = QgsLayoutUtils::scaleFactorFromItemStyle( style );

0 commit comments

Comments
 (0)