Skip to content

Commit

Permalink
Re-use timer in QgsMapCanvas::refresh to ensure multiple refresh requ…
Browse files Browse the repository at this point in the history
…ests get compressed

Forward port from Sourcepole's fork
  • Loading branch information
manisandro authored and nyalldawson committed Jul 17, 2017
1 parent f405b96 commit 514e430
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/gui/qgsmapcanvas.cpp
Expand Up @@ -133,6 +133,10 @@ QgsMapCanvas::QgsMapCanvas( QWidget *parent )
mResizeTimer->setSingleShot( true );
connect( mResizeTimer, &QTimer::timeout, this, &QgsMapCanvas::refresh );

mRefreshTimer = new QTimer( this );
mRefreshTimer->setSingleShot( true );
connect( mRefreshTimer, &QTimer::timeout, this, &QgsMapCanvas::refreshMap );

// create map canvas item which will show the map
mMap = new QgsMapCanvasMap( this );

Expand Down Expand Up @@ -493,7 +497,7 @@ void QgsMapCanvas::refresh()
QgsDebugMsg( "CANVAS refresh scheduling" );

// schedule a refresh
QTimer::singleShot( 1, this, SLOT( refreshMap() ) );
mRefreshTimer->start( 1 );
} // refresh

void QgsMapCanvas::refreshMap()
Expand Down
1 change: 1 addition & 0 deletions src/gui/qgsmapcanvas.h
Expand Up @@ -814,6 +814,7 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
QgsMapRendererCache *mCache = nullptr;

QTimer *mResizeTimer = nullptr;
QTimer *mRefreshTimer = nullptr;

QgsPreviewEffect *mPreviewEffect = nullptr;

Expand Down

0 comments on commit 514e430

Please sign in to comment.