@@ -78,8 +78,10 @@ class QgsMapCanvas::CanvasProperties
78
78
79
79
80
80
QgsMapCanvas::QgsMapCanvas ( QWidget * parent, const char *name )
81
- : QGraphicsView( parent ),
82
- mCanvasProperties( new CanvasProperties )
81
+ : QGraphicsView( parent )
82
+ , mCanvasProperties( new CanvasProperties )
83
+ , mPainting( false )
84
+ , mLastSize( QSize() )
83
85
{
84
86
mScene = new QGraphicsScene ();
85
87
setScene ( mScene );
@@ -943,13 +945,10 @@ void QgsMapCanvas::paintEvent( QPaintEvent *e )
943
945
{
944
946
if ( mNewSize .isValid () )
945
947
{
946
- static bool isAlreadyIn = false ;
947
- static QSize lastSize = QSize ();
948
-
949
- lastSize = mNewSize ;
948
+ mLastSize = mNewSize ;
950
949
mNewSize = QSize ();
951
950
952
- if ( isAlreadyIn || mDrawing )
951
+ if ( mPainting || mDrawing )
953
952
{
954
953
// cancel current render progress
955
954
if ( mMapRenderer )
@@ -962,13 +961,14 @@ void QgsMapCanvas::paintEvent( QPaintEvent *e )
962
961
}
963
962
return ;
964
963
}
965
- isAlreadyIn = true ;
966
964
967
- while ( lastSize.isValid () )
965
+ mPainting = true ;
966
+
967
+ while ( mLastSize .isValid () )
968
968
{
969
- int width = lastSize .width ();
970
- int height = lastSize .height ();
971
- lastSize = QSize ();
969
+ int width = mLastSize .width ();
970
+ int height = mLastSize .height ();
971
+ mLastSize = QSize ();
972
972
973
973
// set map size before scene size helps keep scene indexes updated properly
974
974
// this was the cause of rubberband artifacts
@@ -984,7 +984,8 @@ void QgsMapCanvas::paintEvent( QPaintEvent *e )
984
984
985
985
emit extentsChanged ();
986
986
}
987
- isAlreadyIn = false ;
987
+
988
+ mPainting = false ;
988
989
}
989
990
990
991
QGraphicsView::paintEvent ( e );
0 commit comments