Skip to content
Permalink
Browse files

Also delay initial preview job by a short timeout

  • Loading branch information
nyalldawson committed Aug 17, 2017
1 parent 6c17577 commit 628a1b096b26cb617bf79f9088532afa64bbc47c
Showing with 16 additions and 10 deletions.
  1. +15 −10 src/gui/qgsmapcanvas.cpp
  2. +1 −0 src/gui/qgsmapcanvas.h
@@ -2132,7 +2132,7 @@ const QgsLabelingEngineSettings &QgsMapCanvas::labelingEngineSettings() const
void QgsMapCanvas::startPreviewJobs()
{
stopPreviewJobs(); //just in case still running
startPreviewJob( 0 );
schedulePreviewJob( 0 );
}

void QgsMapCanvas::startPreviewJob( int number )
@@ -2167,15 +2167,7 @@ void QgsMapCanvas::startPreviewJob( int number )

if ( number < 8 )
{
mPreviewTimer.setSingleShot( true );
mPreviewTimer.setInterval( 250 );
disconnect( mPreviewTimerConnection );
mPreviewTimerConnection = connect( &mPreviewTimer, &QTimer::timeout, [ = ]()
{
startPreviewJob( number + 1 );
}
);
mPreviewTimer.start();
schedulePreviewJob( number + 1 );
}
}

@@ -2194,3 +2186,16 @@ void QgsMapCanvas::stopPreviewJobs()
}
mPreviewJobs.clear();
}

void QgsMapCanvas::schedulePreviewJob( int number )
{
mPreviewTimer.setSingleShot( true );
mPreviewTimer.setInterval( 250 );
disconnect( mPreviewTimerConnection );
mPreviewTimerConnection = connect( &mPreviewTimer, &QTimer::timeout, [ = ]()
{
startPreviewJob( number );
}
);
mPreviewTimer.start();
}
@@ -882,6 +882,7 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView

void startPreviewJobs();
void stopPreviewJobs();
void schedulePreviewJob( int number );

friend class TestQgsMapCanvas;

0 comments on commit 628a1b0

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