Skip to content
Permalink
Browse files

Remove merge conflict

  • Loading branch information
m-kuhn authored and mhugent committed Aug 9, 2012
1 parent 1fdacc5 commit 7a0467d4a04bcca6463c26a4a4ce0babeca8f99d
Showing with 86 additions and 36 deletions.
  1. +21 −0 src/app/qgsoptions.cpp
  2. +4 −0 src/app/qgsoptions.h
  3. +13 −11 src/core/qgsvectorlayer.cpp
  4. +6 −0 src/core/qgsvectorlayer.h
  5. +4 −3 src/gui/qgsmapcanvas.cpp
  6. +38 −22 src/ui/qgsoptionsbase.ui
@@ -77,6 +77,8 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :

connect( chkUseStandardDeviation, SIGNAL( stateChanged( int ) ), this, SLOT( toggleStandardDeviation( int ) ) );

connect( chkEnableBackbuffer, SIGNAL( stateChanged( int ) ), this, SLOT( toggleEnableBackbuffer( int ) ) );

connect( this, SIGNAL( accepted() ), this, SLOT( saveOptions() ) );

QStringList styles = QStyleFactory::keys();
@@ -227,6 +229,10 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
if ( index == -1 ) index = 1;
cmbScanZipInBrowser->setCurrentIndex( index );

// Set the enable backbuffer state
chkEnableBackbuffer->setChecked( settings.value( "/Map/enableBackbuffer" ).toBool() );
toggleEnableBackbuffer( chkEnableBackbuffer->checkState() );

// set the display update threshold
spinBoxUpdateThreshold->setValue( settings.value( "/Map/updateThreshold" ).toInt() );
//set the default projection behaviour radio buttongs
@@ -720,6 +726,20 @@ void QgsOptions::toggleStandardDeviation( int state )
}
}

void QgsOptions::toggleEnableBackbuffer( int state )
{
if ( Qt::Checked == state )
{
labelUpdateThreshold->setEnabled( false );
spinBoxUpdateThreshold->setEnabled( false );
}
else
{
labelUpdateThreshold->setEnabled( true );
spinBoxUpdateThreshold->setEnabled( true );
}
}

QString QgsOptions::theme()
{
// returns the current theme (as selected in the cmbTheme combo box)
@@ -891,6 +911,7 @@ void QgsOptions::saveOptions()
settings.setValue( "/Raster/cumulativeCutLower", mRasterCumulativeCutLowerDoubleSpinBox->value() / 100.0 );
settings.setValue( "/Raster/cumulativeCutUpper", mRasterCumulativeCutUpperDoubleSpinBox->value() / 100.0 );

settings.setValue( "/Map/enableBackbuffer", chkEnableBackbuffer->isChecked() );
settings.setValue( "/Map/updateThreshold", spinBoxUpdateThreshold->value() );
//check behaviour so default projection when new layer is added with no
//projection defined...
@@ -74,6 +74,10 @@ class QgsOptions : public QDialog, private Ui::QgsOptionsBase

void toggleStandardDeviation( int );

//! Slot to change backbuffering. This is handled when the user changes
// the value of the checkbox
void toggleEnableBackbuffer( int );

/**
* Return the desired state of newly added layers. If a layer
* is to be drawn when added to the map, this function returns
@@ -733,21 +733,22 @@ void QgsVectorLayer::drawRendererV2( QgsRenderContext& rendererContext, bool lab
{
break;
}
#if 0 // MK: disable this totally as it breaks QT painting engine (can result in recursive repaint)
#ifndef Q_WS_MAC //MH: disable this on Mac for now to avoid problems with resizing
if ( mUpdateThreshold > 0 && 0 == featureCount % mUpdateThreshold )
if ( !mEnableBackbuffer ) // do not handle events, as we're already inside a paint event
{
emit screenUpdateRequested();
// emit drawingProgress( featureCount, totalFeatures );
qApp->processEvents();
}
else if ( featureCount % 1000 == 0 )
{
// emit drawingProgress( featureCount, totalFeatures );
qApp->processEvents();
if ( mUpdateThreshold > 0 && 0 == featureCount % mUpdateThreshold )
{
emit screenUpdateRequested();
// emit drawingProgress( featureCount, totalFeatures );
qApp->processEvents();
}
else if ( featureCount % 1000 == 0 )
{
// emit drawingProgress( featureCount, totalFeatures );
qApp->processEvents();
}
}
#endif //Q_WS_MAC
#endif

bool sel = mSelectedFeatureIds.contains( fet.id() );
bool drawMarker = ( mEditable && ( !vertexMarkerOnlyForSelection || sel ) );
@@ -956,6 +957,7 @@ bool QgsVectorLayer::draw( QgsRenderContext& rendererContext )
//set update threshold before each draw to make sure the current setting is picked up
QSettings settings;
mUpdateThreshold = settings.value( "Map/updateThreshold", 0 ).toInt();
mEnableBackbuffer = settings.value( "/Map/enableBackbuffer", 1 ).toBool();

if ( mUsingRendererV2 )
{
@@ -866,6 +866,12 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
*/
int mUpdateThreshold;

/** Enables backbuffering for the map window. This improves graphics performance,
* but the possibility to cancel rendering and incremental feature drawing will be lost.
*
*/
bool mEnableBackbuffer;

/** Pointer to data provider derived from the abastract base class QgsDataProvider */
QgsVectorDataProvider *mDataProvider;

@@ -84,15 +84,16 @@ QgsMapCanvas::QgsMapCanvas( QWidget * parent, const char *name )
, mAntiAliasing( false )
{
setObjectName( name );


QSettings settings;
bool enableBackbuffer = settings.value( "/Map/enableBackbuffer", 1 ).toBool();
//disable the update that leads to the resize crash
if ( viewport() )
if ( viewport() && !enableBackbuffer )
{
#ifndef ANDROID
viewport()->setAttribute( Qt::WA_PaintOnScreen, true );
#endif //ANDROID
}
#endif

mScene = new QGraphicsScene();
setScene( mScene );
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>526</height>
<width>1107</width>
<height>843</height>
</rect>
</property>
<property name="windowTitle">
@@ -33,7 +33,7 @@
<item row="2" column="0">
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
<number>3</number>
</property>
<property name="iconSize">
<size>
@@ -953,46 +953,63 @@
<string>Rendering behavior</string>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<item row="1" column="0">
<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="2" column="0" colspan="2">
<item row="4" column="0" colspan="3">
<widget class="QLabel" name="textLabel3">
<property name="text">
<string>&lt;b&gt;Note:&lt;/b&gt; Use zero to prevent display updates until all features have been rendered</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<item row="5" column="0" colspan="3">
<widget class="QCheckBox" name="chkUseRenderCaching">
<property name="text">
<string>Use render caching where possible to speed up redraws</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="textLabel1_6">
<item row="2" column="0">
<widget class="QCheckBox" name="chkEnableBackbuffer">
<property name="text">
<string>Number of features to draw before updating the display</string>
<string>Enable back buffer (Better graphics performance at the cost loosing the possibiliti to cancel rendering and incremental feature drawing)</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="spinBoxUpdateThreshold">
<property name="toolTip">
<string>Map display will be updated (drawn) after this many features have been read from the data source</string>
</property>
<property name="maximum">
<number>1000000</number>
</property>
<property name="value">
<number>1000</number>
</property>
</widget>
<item row="3" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_16">
<item>
<widget class="QLabel" name="labelUpdateThreshold">
<property name="text">
<string>Number of features to draw before updating the display</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBoxUpdateThreshold">
<property name="maximumSize">
<size>
<width>200</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Map display will be updated (drawn) after this many features have been read from the data source</string>
</property>
<property name="maximum">
<number>1000000</number>
</property>
<property name="value">
<number>1000</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
@@ -2693,7 +2710,6 @@
<tabstop>buttonBox</tabstop>
<tabstop>scrollArea_3</tabstop>
<tabstop>chkAddedVisibility</tabstop>
<tabstop>spinBoxUpdateThreshold</tabstop>
<tabstop>chkUseRenderCaching</tabstop>
<tabstop>chkAntiAliasing</tabstop>
<tabstop>chkUseQPixmap</tabstop>

0 comments on commit 7a0467d

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