Skip to content

Commit 7a0467d

Browse files
m-kuhnmhugent
authored andcommitted
Remove merge conflict
1 parent 1fdacc5 commit 7a0467d

File tree

6 files changed

+86
-36
lines changed

6 files changed

+86
-36
lines changed

src/app/qgsoptions.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
7777

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

80+
connect( chkEnableBackbuffer, SIGNAL( stateChanged( int ) ), this, SLOT( toggleEnableBackbuffer( int ) ) );
81+
8082
connect( this, SIGNAL( accepted() ), this, SLOT( saveOptions() ) );
8183

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

232+
// Set the enable backbuffer state
233+
chkEnableBackbuffer->setChecked( settings.value( "/Map/enableBackbuffer" ).toBool() );
234+
toggleEnableBackbuffer( chkEnableBackbuffer->checkState() );
235+
230236
// set the display update threshold
231237
spinBoxUpdateThreshold->setValue( settings.value( "/Map/updateThreshold" ).toInt() );
232238
//set the default projection behaviour radio buttongs
@@ -720,6 +726,20 @@ void QgsOptions::toggleStandardDeviation( int state )
720726
}
721727
}
722728

729+
void QgsOptions::toggleEnableBackbuffer( int state )
730+
{
731+
if ( Qt::Checked == state )
732+
{
733+
labelUpdateThreshold->setEnabled( false );
734+
spinBoxUpdateThreshold->setEnabled( false );
735+
}
736+
else
737+
{
738+
labelUpdateThreshold->setEnabled( true );
739+
spinBoxUpdateThreshold->setEnabled( true );
740+
}
741+
}
742+
723743
QString QgsOptions::theme()
724744
{
725745
// returns the current theme (as selected in the cmbTheme combo box)
@@ -891,6 +911,7 @@ void QgsOptions::saveOptions()
891911
settings.setValue( "/Raster/cumulativeCutLower", mRasterCumulativeCutLowerDoubleSpinBox->value() / 100.0 );
892912
settings.setValue( "/Raster/cumulativeCutUpper", mRasterCumulativeCutUpperDoubleSpinBox->value() / 100.0 );
893913

914+
settings.setValue( "/Map/enableBackbuffer", chkEnableBackbuffer->isChecked() );
894915
settings.setValue( "/Map/updateThreshold", spinBoxUpdateThreshold->value() );
895916
//check behaviour so default projection when new layer is added with no
896917
//projection defined...

src/app/qgsoptions.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ class QgsOptions : public QDialog, private Ui::QgsOptionsBase
7474

7575
void toggleStandardDeviation( int );
7676

77+
//! Slot to change backbuffering. This is handled when the user changes
78+
// the value of the checkbox
79+
void toggleEnableBackbuffer( int );
80+
7781
/**
7882
* Return the desired state of newly added layers. If a layer
7983
* is to be drawn when added to the map, this function returns

src/core/qgsvectorlayer.cpp

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -733,21 +733,22 @@ void QgsVectorLayer::drawRendererV2( QgsRenderContext& rendererContext, bool lab
733733
{
734734
break;
735735
}
736-
#if 0 // MK: disable this totally as it breaks QT painting engine (can result in recursive repaint)
737736
#ifndef Q_WS_MAC //MH: disable this on Mac for now to avoid problems with resizing
738-
if ( mUpdateThreshold > 0 && 0 == featureCount % mUpdateThreshold )
737+
if ( !mEnableBackbuffer ) // do not handle events, as we're already inside a paint event
739738
{
740-
emit screenUpdateRequested();
741-
// emit drawingProgress( featureCount, totalFeatures );
742-
qApp->processEvents();
743-
}
744-
else if ( featureCount % 1000 == 0 )
745-
{
746-
// emit drawingProgress( featureCount, totalFeatures );
747-
qApp->processEvents();
739+
if ( mUpdateThreshold > 0 && 0 == featureCount % mUpdateThreshold )
740+
{
741+
emit screenUpdateRequested();
742+
// emit drawingProgress( featureCount, totalFeatures );
743+
qApp->processEvents();
744+
}
745+
else if ( featureCount % 1000 == 0 )
746+
{
747+
// emit drawingProgress( featureCount, totalFeatures );
748+
qApp->processEvents();
749+
}
748750
}
749751
#endif //Q_WS_MAC
750-
#endif
751752

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

960962
if ( mUsingRendererV2 )
961963
{

src/core/qgsvectorlayer.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,12 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
866866
*/
867867
int mUpdateThreshold;
868868

869+
/** Enables backbuffering for the map window. This improves graphics performance,
870+
* but the possibility to cancel rendering and incremental feature drawing will be lost.
871+
*
872+
*/
873+
bool mEnableBackbuffer;
874+
869875
/** Pointer to data provider derived from the abastract base class QgsDataProvider */
870876
QgsVectorDataProvider *mDataProvider;
871877

src/gui/qgsmapcanvas.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,16 @@ QgsMapCanvas::QgsMapCanvas( QWidget * parent, const char *name )
8484
, mAntiAliasing( false )
8585
{
8686
setObjectName( name );
87-
87+
88+
QSettings settings;
89+
bool enableBackbuffer = settings.value( "/Map/enableBackbuffer", 1 ).toBool();
8890
//disable the update that leads to the resize crash
89-
if ( viewport() )
91+
if ( viewport() && !enableBackbuffer )
9092
{
9193
#ifndef ANDROID
9294
viewport()->setAttribute( Qt::WA_PaintOnScreen, true );
9395
#endif //ANDROID
9496
}
95-
#endif
9697

9798
mScene = new QGraphicsScene();
9899
setScene( mScene );

src/ui/qgsoptionsbase.ui

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>800</width>
10-
<height>526</height>
9+
<width>1107</width>
10+
<height>843</height>
1111
</rect>
1212
</property>
1313
<property name="windowTitle">
@@ -33,7 +33,7 @@
3333
<item row="2" column="0">
3434
<widget class="QTabWidget" name="tabWidget">
3535
<property name="currentIndex">
36-
<number>0</number>
36+
<number>3</number>
3737
</property>
3838
<property name="iconSize">
3939
<size>
@@ -953,46 +953,63 @@
953953
<string>Rendering behavior</string>
954954
</property>
955955
<layout class="QGridLayout">
956-
<item row="0" column="0">
956+
<item row="1" column="0">
957957
<widget class="QCheckBox" name="chkAddedVisibility">
958958
<property name="text">
959959
<string>By default new la&amp;yers added to the map should be displayed</string>
960960
</property>
961961
</widget>
962962
</item>
963-
<item row="2" column="0" colspan="2">
963+
<item row="4" column="0" colspan="3">
964964
<widget class="QLabel" name="textLabel3">
965965
<property name="text">
966966
<string>&lt;b&gt;Note:&lt;/b&gt; Use zero to prevent display updates until all features have been rendered</string>
967967
</property>
968968
</widget>
969969
</item>
970-
<item row="3" column="0" colspan="2">
970+
<item row="5" column="0" colspan="3">
971971
<widget class="QCheckBox" name="chkUseRenderCaching">
972972
<property name="text">
973973
<string>Use render caching where possible to speed up redraws</string>
974974
</property>
975975
</widget>
976976
</item>
977-
<item row="1" column="0">
978-
<widget class="QLabel" name="textLabel1_6">
977+
<item row="2" column="0">
978+
<widget class="QCheckBox" name="chkEnableBackbuffer">
979979
<property name="text">
980-
<string>Number of features to draw before updating the display</string>
980+
<string>Enable back buffer (Better graphics performance at the cost loosing the possibiliti to cancel rendering and incremental feature drawing)</string>
981981
</property>
982982
</widget>
983983
</item>
984-
<item row="1" column="1">
985-
<widget class="QSpinBox" name="spinBoxUpdateThreshold">
986-
<property name="toolTip">
987-
<string>Map display will be updated (drawn) after this many features have been read from the data source</string>
988-
</property>
989-
<property name="maximum">
990-
<number>1000000</number>
991-
</property>
992-
<property name="value">
993-
<number>1000</number>
994-
</property>
995-
</widget>
984+
<item row="3" column="0">
985+
<layout class="QHBoxLayout" name="horizontalLayout_16">
986+
<item>
987+
<widget class="QLabel" name="labelUpdateThreshold">
988+
<property name="text">
989+
<string>Number of features to draw before updating the display</string>
990+
</property>
991+
</widget>
992+
</item>
993+
<item>
994+
<widget class="QSpinBox" name="spinBoxUpdateThreshold">
995+
<property name="maximumSize">
996+
<size>
997+
<width>200</width>
998+
<height>16777215</height>
999+
</size>
1000+
</property>
1001+
<property name="toolTip">
1002+
<string>Map display will be updated (drawn) after this many features have been read from the data source</string>
1003+
</property>
1004+
<property name="maximum">
1005+
<number>1000000</number>
1006+
</property>
1007+
<property name="value">
1008+
<number>1000</number>
1009+
</property>
1010+
</widget>
1011+
</item>
1012+
</layout>
9961013
</item>
9971014
</layout>
9981015
</widget>
@@ -2693,7 +2710,6 @@
26932710
<tabstop>buttonBox</tabstop>
26942711
<tabstop>scrollArea_3</tabstop>
26952712
<tabstop>chkAddedVisibility</tabstop>
2696-
<tabstop>spinBoxUpdateThreshold</tabstop>
26972713
<tabstop>chkUseRenderCaching</tabstop>
26982714
<tabstop>chkAntiAliasing</tabstop>
26992715
<tabstop>chkUseQPixmap</tabstop>

0 commit comments

Comments
 (0)