Skip to content
Permalink
Browse files

Re-use timer in QgsMapCanvas::refresh to ensure multiple refresh requ…

…ests get compressed

Forward port from Sourcepole's fork
  • Loading branch information
manisandro authored and nyalldawson committed Jul 17, 2017
1 parent f405b96 commit 514e43057a5e663f967d25212914e9f6f6d9363f
Showing with 6 additions and 1 deletion.
  1. +5 −1 src/gui/qgsmapcanvas.cpp
  2. +1 −0 src/gui/qgsmapcanvas.h
@@ -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 );

@@ -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()
@@ -814,6 +814,7 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
QgsMapRendererCache *mCache = nullptr;

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

QgsPreviewEffect *mPreviewEffect = nullptr;

0 comments on commit 514e430

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