Skip to content

Commit e2e23f0

Browse files
committed
snapping dialog: block signals when reloading snapping options
QgsProject: also apply default when property is not available and not only if an existing one is invalid fixes #12192
1 parent ccdf452 commit e2e23f0

File tree

3 files changed

+176
-302
lines changed

3 files changed

+176
-302
lines changed

python/core/qgsproject.sip

-30
Original file line numberDiff line numberDiff line change
@@ -132,36 +132,6 @@ class QgsProject : QObject
132132
bool write();
133133
//@}
134134

135-
136-
/// syntactic sugar for property lists
137-
// DEPRECATED typedef QPair< QString, QVariant > PropertyValue;
138-
// DEPRECATED typedef QValueList< PropertyValue > Properties;
139-
140-
/** extra properties, typically added by plug-ins
141-
142-
This allows for extra properties to be associated with projects. Think
143-
of it as a registry bound to a project.
144-
145-
Properties are arbitrary values keyed by a name and associated with a
146-
scope. The scope would presumably refer to your plug-in.
147-
E.g., "openmodeller".
148-
149-
@note
150-
151-
E.g., open modeller might use:
152-
153-
<code>"QgsProject::instance()->properties("openmodeller")["foo"]</code>.
154-
155-
@todo "properties" is, overall, a good name; but that might imply that
156-
the qgis specific state properites are different since they aren't
157-
accessible here. Actually, what if we make "qgis" yet another
158-
scope that stores its state in the properties list? E.g.,
159-
QgsProject::instance()->properties()["qgis"]?
160-
161-
162-
*/
163-
// DEPRECATED Properties & properties( QString const & scope );
164-
165135
/**
166136
removes all project properties
167137

src/app/qgssnappingdialog.cpp

+8-2
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,21 @@ void QgsSnappingDialog::reload()
133133
idx = 0;
134134
else // off
135135
idx = 3;
136+
mDefaultSnapToComboBox->blockSignals( true );
136137
mDefaultSnapToComboBox->setCurrentIndex( idx );
138+
mDefaultSnapToComboBox->blockSignals( false );
137139

138140
double tolerance = settings.value( "/qgis/digitizing/default_snapping_tolerance", 0 ).toDouble();
139141
tolerance = QgsProject::instance()->readDoubleEntry( "Digitizing", "/DefaultSnapTolerance", tolerance );
142+
mDefaultSnappingToleranceSpinBox->blockSignals( true );
140143
mDefaultSnappingToleranceSpinBox->setValue( tolerance );
144+
mDefaultSnappingToleranceSpinBox->blockSignals( false );
141145

142146
int unit = settings.value( "/qgis/digitizing/default_snapping_tolerance_unit", QgsTolerance::ProjectUnits ).toInt();
143147
unit = QgsProject::instance()->readNumEntry( "Digitizing", "/DefaultSnapToleranceUnit", unit );
148+
mDefaultSnappingToleranceComboBox->blockSignals( true );
144149
mDefaultSnappingToleranceComboBox->setCurrentIndex( unit == QgsTolerance::Pixels ? 1 : 0 );
150+
mDefaultSnappingToleranceComboBox->blockSignals( false );
145151

146152
mLayerTreeWidget->clear();
147153

@@ -202,7 +208,6 @@ void QgsSnappingDialog::closeEvent( QCloseEvent* event )
202208
}
203209
}
204210

205-
206211
void QgsSnappingDialog::apply()
207212
{
208213
QString snapMode;
@@ -492,12 +497,13 @@ void QgsSnappingDialog::setIntersectionSnappingState()
492497

493498
void QgsSnappingDialog::setSnappingMode()
494499
{
500+
mSnapModeComboBox->blockSignals( true );
495501
QString snapMode = QgsProject::instance()->readEntry( "Digitizing", "/SnappingMode" );
496502
if ( snapMode == "current_layer" )
497503
mSnapModeComboBox->setCurrentIndex( 0 );
498504
else if ( snapMode == "all_layers" )
499505
mSnapModeComboBox->setCurrentIndex( 1 );
500506
else // "advanced" or empty (backward compatibility)
501507
mSnapModeComboBox->setCurrentIndex( 2 );
508+
mSnapModeComboBox->blockSignals( false );
502509
}
503-

0 commit comments

Comments
 (0)