diff --git a/python/gui/qgsmapcanvas.sip b/python/gui/qgsmapcanvas.sip index 50c67173865..62c97a9e630 100644 --- a/python/gui/qgsmapcanvas.sip +++ b/python/gui/qgsmapcanvas.sip @@ -91,6 +91,14 @@ class QgsMapCanvas : QGraphicsView //! @note added in 2.1 bool isParallelRenderingEnabled() const; + //! Set how often map preview should be updated while it is being rendered (in miliseconds) + //! @note added in 2.1 + void setMapUpdateInterval( int timeMiliseconds ); + + //! Find out how often map preview should be updated while it is being rendered (in miliseconds) + //! @note added in 2.1 + int mapUpdateInterval() const; + //! @deprecated since 2.1 - there could be more than just one "map" items QgsMapCanvasMap* map(); diff --git a/src/app/qgisapp.cpp b/src/app/qgisapp.cpp index 6ba6d60f800..4c879608077 100644 --- a/src/app/qgisapp.cpp +++ b/src/app/qgisapp.cpp @@ -2073,6 +2073,8 @@ void QgisApp::createOverview() mMapCanvas->setCachingEnabled( mySettings.value( "/qgis/enable_render_caching", false ).toBool() ); mMapCanvas->setParallelRenderingEnabled( mySettings.value( "/qgis/parallel_rendering", false).toBool() ); + + mMapCanvas->setMapUpdateInterval( mySettings.value( "/qgis/map_update_interval", 250 ).toInt() ); } void QgisApp::addDockWidget( Qt::DockWidgetArea theArea, QDockWidget * thepDockWidget ) @@ -6607,6 +6609,8 @@ void QgisApp::options() mMapCanvas->setParallelRenderingEnabled( mySettings.value( "/qgis/parallel_rendering", false).toBool() ); + mMapCanvas->setMapUpdateInterval( mySettings.value( "/qgis/map_update_interval", 250 ).toInt() ); + //do we need this? TS mMapCanvas->refresh(); diff --git a/src/app/qgsoptions.cpp b/src/app/qgsoptions.cpp index 260a44a8743..105a3f2a10f 100644 --- a/src/app/qgsoptions.cpp +++ b/src/app/qgsoptions.cpp @@ -499,6 +499,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) : chkAntiAliasing->setChecked( settings.value( "/qgis/enable_anti_aliasing", true ).toBool() ); chkUseRenderCaching->setChecked( settings.value( "/qgis/enable_render_caching", false ).toBool() ); chkParallelRendering->setChecked( settings.value( "/qgis/parallel_rendering", false ).toBool() ); + spinMapUpdateInterval->setValue( settings.value( "/qgis/map_update_interval", 250 ).toInt() ); // Slightly awkard here at the settings value is true to use QImage, // but the checkbox is true to use QPixmap @@ -934,6 +935,7 @@ void QgsOptions::saveOptions() settings.setValue( "/qgis/enable_anti_aliasing", chkAntiAliasing->isChecked() ); settings.setValue( "/qgis/enable_render_caching", chkUseRenderCaching->isChecked() ); settings.setValue( "/qgis/parallel_rendering", chkParallelRendering->isChecked() ); + settings.setValue( "/qgis/map_update_interval", spinMapUpdateInterval->value() ); settings.setValue( "/qgis/legendDoubleClickAction", cmbLegendDoubleClickAction->currentIndex() ); bool legendLayersCapitalise = settings.value( "/qgis/capitaliseLayerName", false ).toBool(); settings.setValue( "/qgis/capitaliseLayerName", capitaliseCheckBox->isChecked() ); diff --git a/src/gui/qgsmapcanvas.cpp b/src/gui/qgsmapcanvas.cpp index e4753a3ce8a..3cc160497bc 100644 --- a/src/gui/qgsmapcanvas.cpp +++ b/src/gui/qgsmapcanvas.cpp @@ -208,7 +208,7 @@ QgsMapCanvas::QgsMapCanvas( QWidget * parent, const char *name ) moveCanvasContents( true ); connect(&mMapUpdateTimer, SIGNAL( timeout() ), SLOT( mapUpdateTimeout() ) ); - mMapUpdateTimer.setInterval( 400 ); + mMapUpdateTimer.setInterval( 250 ); #ifdef Q_OS_WIN // Enable touch event on Windows. @@ -525,6 +525,16 @@ bool QgsMapCanvas::isParallelRenderingEnabled() const return mUseParallelRendering; } +void QgsMapCanvas::setMapUpdateInterval( int timeMiliseconds ) +{ + mMapUpdateTimer.setInterval( timeMiliseconds ); +} + +int QgsMapCanvas::mapUpdateInterval() const +{ + return mMapUpdateTimer.interval(); +} + void QgsMapCanvas::updateOverview() { diff --git a/src/gui/qgsmapcanvas.h b/src/gui/qgsmapcanvas.h index ee098e623f1..51b89e2c9f2 100644 --- a/src/gui/qgsmapcanvas.h +++ b/src/gui/qgsmapcanvas.h @@ -162,6 +162,14 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView //! @note added in 2.1 bool isParallelRenderingEnabled() const; + //! Set how often map preview should be updated while it is being rendered (in miliseconds) + //! @note added in 2.1 + void setMapUpdateInterval( int timeMiliseconds ); + + //! Find out how often map preview should be updated while it is being rendered (in miliseconds) + //! @note added in 2.1 + int mapUpdateInterval() const; + //! @deprecated since 2.1 - there could be more than just one "map" items QgsMapCanvasMap* map(); diff --git a/src/ui/qgsoptionsbase.ui b/src/ui/qgsoptionsbase.ui index 6c0e36c476a..dcc2fd114d9 100644 --- a/src/ui/qgsoptionsbase.ui +++ b/src/ui/qgsoptionsbase.ui @@ -236,7 +236,7 @@ - 0 + 3 @@ -1578,7 +1578,7 @@ 0 0 670 - 631 + 666 @@ -1587,28 +1587,68 @@ Rendering behavior - - + + By default new la&yers added to the map should be displayed - + Use render caching where possible to speed up redraws - + Render layers in parallel using all available CPU cores + + + + + + Map update interval + + + + + + + ms + + + 999999 + + + 50 + + + 250 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + +