Skip to content
Permalink
Browse files

fix canvas refresh

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15249 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Feb 23, 2011
1 parent b572d5a commit 5b947a15bd176cbe6fc13e64f97895ab1547f2ae
Showing with 19 additions and 14 deletions.
  1. +14 −13 src/gui/qgsmapcanvas.cpp
  2. +5 −1 src/gui/qgsmapcanvas.h
@@ -78,8 +78,10 @@ class QgsMapCanvas::CanvasProperties


QgsMapCanvas::QgsMapCanvas( QWidget * parent, const char *name )
: QGraphicsView( parent ),
mCanvasProperties( new CanvasProperties )
: QGraphicsView( parent )
, mCanvasProperties( new CanvasProperties )
, mPainting( false )
, mLastSize( QSize() )
{
mScene = new QGraphicsScene();
setScene( mScene );
@@ -943,13 +945,10 @@ void QgsMapCanvas::paintEvent( QPaintEvent *e )
{
if ( mNewSize.isValid() )
{
static bool isAlreadyIn = false;
static QSize lastSize = QSize();

lastSize = mNewSize;
mLastSize = mNewSize;
mNewSize = QSize();

if ( isAlreadyIn || mDrawing )
if ( mPainting || mDrawing )
{
//cancel current render progress
if ( mMapRenderer )
@@ -962,13 +961,14 @@ void QgsMapCanvas::paintEvent( QPaintEvent *e )
}
return;
}
isAlreadyIn = true;

while ( lastSize.isValid() )
mPainting = true;

while ( mLastSize.isValid() )
{
int width = lastSize.width();
int height = lastSize.height();
lastSize = QSize();
int width = mLastSize.width();
int height = mLastSize.height();
mLastSize = QSize();

//set map size before scene size helps keep scene indexes updated properly
// this was the cause of rubberband artifacts
@@ -984,7 +984,8 @@ void QgsMapCanvas::paintEvent( QPaintEvent *e )

emit extentsChanged();
}
isAlreadyIn = false;

mPainting = false;
}

QGraphicsView::paintEvent( e );
@@ -77,7 +77,6 @@ class GUI_EXPORT QgsMapCanvasLayer
const QgsMapLayer* layer() const { return mLayer; }

private:

QgsMapLayer* mLayer;

/** Flag whether layer is visible */
@@ -461,6 +460,11 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
//! resize canvas size
QSize mNewSize;

//! currently in paint event
bool mPainting;

//! size of last resize event
QSize mLastSize;
}; // class QgsMapCanvas


0 comments on commit 5b947a1

Please sign in to comment.
You can’t perform that action at this time.