Skip to content

Commit

Permalink
use QgsProjectDirtyBlocker instead of connect disconnect dance
Browse files Browse the repository at this point in the history
  • Loading branch information
NEDJIMAbelgacem authored and nyalldawson committed Jan 12, 2022
1 parent 96f7c47 commit 66b481a
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 41 deletions.
2 changes: 0 additions & 2 deletions python/3d/auto_generated/qgs3dmapsettings.sip.in
Expand Up @@ -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

Expand Down
37 changes: 1 addition & 36 deletions src/3d/qgs3dmapsettings.cpp
Expand Up @@ -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(),
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 );
}

3 changes: 0 additions & 3 deletions src/3d/qgs3dmapsettings.h
Expand Up @@ -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();
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 66b481a

Please sign in to comment.