Skip to content
Permalink
Browse files
use QgsProjectDirtyBlocker instead of connect disconnect dance
  • Loading branch information
NEDJIMAbelgacem authored and nyalldawson committed Jan 12, 2022
1 parent 96f7c47 commit 66b481ac364e42057538e8f70a011e6de5c85cd1
Showing with 1 addition and 41 deletions.
  1. +0 −2 python/3d/auto_generated/qgs3dmapsettings.sip.in
  2. +1 −36 src/3d/qgs3dmapsettings.cpp
  3. +0 −3 src/3d/qgs3dmapsettings.h
@@ -609,8 +609,6 @@ Sets whether the 2D terrain surface will be rendered in.
%Docstring
Emitted when one of the configuration settings has changed

.. seealso:: :py:func:`connectChangedSignalsToSettingsChanged`

.. versionadded:: 3.24
%End

@@ -108,7 +108,7 @@ Qgs3DMapSettings::~Qgs3DMapSettings()

void Qgs3DMapSettings::readXml( const QDomElement &elem, const QgsReadWriteContext &context )
{
disconnectChangedSignalsToSettingsChanged();
QgsProjectDirtyBlocker blocker( QgsProject::instance() );
QDomElement elemOrigin = elem.firstChildElement( QStringLiteral( "origin" ) );
mOrigin = QgsVector3D(
elemOrigin.attribute( QStringLiteral( "x" ) ).toDouble(),
@@ -289,7 +289,6 @@ void Qgs3DMapSettings::readXml( const QDomElement &elem, const QgsReadWriteConte
QDateTime start = QDateTime::fromString( elemTemporalRange.attribute( QStringLiteral( "start" ) ), Qt::ISODate );
QDateTime end = QDateTime::fromString( elemTemporalRange.attribute( QStringLiteral( "end" ) ), Qt::ISODate );
setTemporalRange( QgsDateTimeRange( start, end ) );
connectChangedSignalsToSettingsChanged();
}

QDomElement Qgs3DMapSettings::writeXml( QDomDocument &doc, const QgsReadWriteContext &context ) const
@@ -847,37 +846,3 @@ void Qgs3DMapSettings::connectChangedSignalsToSettingsChanged()
connect( this, &Qgs3DMapSettings::fpsCounterEnabledChanged, this, &Qgs3DMapSettings::settingsChanged );
}

void Qgs3DMapSettings::disconnectChangedSignalsToSettingsChanged()
{
disconnect( this, &Qgs3DMapSettings::selectionColorChanged, this, &Qgs3DMapSettings::settingsChanged );
disconnect( this, &Qgs3DMapSettings::layersChanged, this, &Qgs3DMapSettings::settingsChanged );
disconnect( this, &Qgs3DMapSettings::terrainGeneratorChanged, this, &Qgs3DMapSettings::settingsChanged );
disconnect( this, &Qgs3DMapSettings::terrainVerticalScaleChanged, this, &Qgs3DMapSettings::settingsChanged );
disconnect( this, &Qgs3DMapSettings::mapTileResolutionChanged, this, &Qgs3DMapSettings::settingsChanged );
disconnect( this, &Qgs3DMapSettings::maxTerrainScreenErrorChanged, this, &Qgs3DMapSettings::settingsChanged );
disconnect( this, &Qgs3DMapSettings::maxTerrainGroundErrorChanged, this, &Qgs3DMapSettings::settingsChanged );
disconnect( this, &Qgs3DMapSettings::terrainElevationOffsetChanged, this, &Qgs3DMapSettings::settingsChanged );
disconnect( this, &Qgs3DMapSettings::terrainShadingChanged, this, &Qgs3DMapSettings::settingsChanged );
disconnect( this, &Qgs3DMapSettings::terrainMapThemeChanged, this, &Qgs3DMapSettings::settingsChanged );
disconnect( this, &Qgs3DMapSettings::renderersChanged, this, &Qgs3DMapSettings::settingsChanged );
disconnect( this, &Qgs3DMapSettings::showTerrainBoundingBoxesChanged, this, &Qgs3DMapSettings::settingsChanged );
disconnect( this, &Qgs3DMapSettings::showTerrainTilesInfoChanged, this, &Qgs3DMapSettings::settingsChanged );
disconnect( this, &Qgs3DMapSettings::showCameraViewCenterChanged, this, &Qgs3DMapSettings::settingsChanged );
disconnect( this, &Qgs3DMapSettings::showCameraRotationCenterChanged, this, &Qgs3DMapSettings::settingsChanged );
disconnect( this, &Qgs3DMapSettings::showLightSourceOriginsChanged, this, &Qgs3DMapSettings::settingsChanged );
disconnect( this, &Qgs3DMapSettings::eyeDomeLightingEnabledChanged, this, &Qgs3DMapSettings::settingsChanged );
disconnect( this, &Qgs3DMapSettings::eyeDomeLightingStrengthChanged, this, &Qgs3DMapSettings::settingsChanged );
disconnect( this, &Qgs3DMapSettings::eyeDomeLightingDistanceChanged, this, &Qgs3DMapSettings::settingsChanged );
disconnect( this, &Qgs3DMapSettings::debugShadowMapSettingsChanged, this, &Qgs3DMapSettings::settingsChanged );
disconnect( this, &Qgs3DMapSettings::debugDepthMapSettingsChanged, this, &Qgs3DMapSettings::settingsChanged );
disconnect( this, &Qgs3DMapSettings::pointLightsChanged, this, &Qgs3DMapSettings::settingsChanged );
disconnect( this, &Qgs3DMapSettings::directionalLightsChanged, this, &Qgs3DMapSettings::settingsChanged );
disconnect( this, &Qgs3DMapSettings::fieldOfViewChanged, this, &Qgs3DMapSettings::settingsChanged );
disconnect( this, &Qgs3DMapSettings::projectionTypeChanged, this, &Qgs3DMapSettings::settingsChanged );
disconnect( this, &Qgs3DMapSettings::cameraNavigationModeChanged, this, &Qgs3DMapSettings::settingsChanged );
disconnect( this, &Qgs3DMapSettings::cameraMovementSpeedChanged, this, &Qgs3DMapSettings::settingsChanged );
disconnect( this, &Qgs3DMapSettings::skyboxSettingsChanged, this, &Qgs3DMapSettings::settingsChanged );
disconnect( this, &Qgs3DMapSettings::shadowSettingsChanged, this, &Qgs3DMapSettings::settingsChanged );
disconnect( this, &Qgs3DMapSettings::fpsCounterEnabledChanged, this, &Qgs3DMapSettings::settingsChanged );
}

@@ -574,7 +574,6 @@ class _3D_EXPORT Qgs3DMapSettings : public QObject, public QgsTemporalRangeObjec
/**
* Emitted when one of the configuration settings has changed
*
* \see connectChangedSignalsToSettingsChanged() disconnectChangedSignalsToSettingsChanged()
* \since QGIS 3.24
*/
void settingsChanged();
@@ -745,8 +744,6 @@ class _3D_EXPORT Qgs3DMapSettings : public QObject, public QgsTemporalRangeObjec
private:
//! Connects the various changed signals of this widget to the settingsChanged signal
void connectChangedSignalsToSettingsChanged();
//! Disconnects the various changed signals of this widget to the settingsChanged signal
void disconnectChangedSignalsToSettingsChanged();

private:
//! Offset in map CRS coordinates at which our 3D world has origin (0,0,0)

0 comments on commit 66b481a

Please sign in to comment.