Skip to content
Permalink
Browse files

User-configurable update interval

  • Loading branch information
wonder-sk committed Dec 11, 2013
1 parent 90b10f7 commit d3b5fb01cdad05de55a2f8f43e023d7795eb2d0b
Showing with 79 additions and 7 deletions.
  1. +8 −0 python/gui/qgsmapcanvas.sip
  2. +4 −0 src/app/qgisapp.cpp
  3. +2 −0 src/app/qgsoptions.cpp
  4. +11 −1 src/gui/qgsmapcanvas.cpp
  5. +8 −0 src/gui/qgsmapcanvas.h
  6. +46 −6 src/ui/qgsoptionsbase.ui
@@ -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();

@@ -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();

@@ -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() );
@@ -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()
{
@@ -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();

@@ -236,7 +236,7 @@
<item>
<widget class="QStackedWidget" name="mOptionsStackedWidget">
<property name="currentIndex">
<number>0</number>
<number>3</number>
</property>
<widget class="QWidget" name="mOptionsPage_01">
<layout class="QVBoxLayout" name="verticalLayout_3">
@@ -1578,7 +1578,7 @@
<x>0</x>
<y>0</y>
<width>670</width>
<height>631</height>
<height>666</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_29">
@@ -1587,28 +1587,68 @@
<property name="title">
<string>Rendering behavior</string>
</property>
<layout class="QGridLayout" name="_4">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_9">
<item>
<widget class="QCheckBox" name="chkAddedVisibility">
<property name="text">
<string>By default new la&amp;yers added to the map should be displayed</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<item>
<widget class="QCheckBox" name="chkUseRenderCaching">
<property name="text">
<string>Use render caching where possible to speed up redraws</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<item>
<widget class="QCheckBox" name="chkParallelRendering">
<property name="text">
<string>Render layers in parallel using all available CPU cores</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_56">
<property name="text">
<string>Map update interval</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinMapUpdateInterval">
<property name="suffix">
<string> ms</string>
</property>
<property name="maximum">
<number>999999</number>
</property>
<property name="singleStep">
<number>50</number>
</property>
<property name="value">
<number>250</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_38">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>

0 comments on commit d3b5fb0

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