Skip to content

Commit

Permalink
follow-up
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Feb 1, 2023
1 parent a695fd6 commit ea325a1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
5 changes: 2 additions & 3 deletions src/core/settings/qgssettingsregistrycore.cpp
Expand Up @@ -161,7 +161,7 @@ void QgsSettingsRegistryCore::migrateOldSettings()
}
else
{
name.replace( '_', '-' );
name.replace( '-', '_' );
}
setting->copyValueFromKey( QString( "qgis/digitizing/%1" ).arg( name ) );
}
Expand Down Expand Up @@ -353,7 +353,6 @@ void QgsSettingsRegistryCore::backwardCompatibility()
{
QString name = setting->name();
if (
name == settingsDigitizingStreamTolerance->name() ||
name == settingsDigitizingLineColor->name() ||
name == settingsDigitizingFillColor->name()
)
Expand All @@ -364,7 +363,7 @@ void QgsSettingsRegistryCore::backwardCompatibility()
}
else
{
name.replace( '_', '-' );
name.replace( '-', '_' );
}
setting->copyValueToKey( QString( "qgis/digitizing/%1" ).arg( name ) );
}
Expand Down
2 changes: 0 additions & 2 deletions src/gui/qgsmaptooledit.cpp
Expand Up @@ -42,7 +42,6 @@ double QgsMapToolEdit::defaultZValue()
double QgsMapToolEdit::defaultMValue()
{
return QgsSettingsRegistryCore::settingsDigitizingDefaultMValue->value();

}

QColor QgsMapToolEdit::digitizingStrokeColor()
Expand All @@ -63,7 +62,6 @@ QColor QgsMapToolEdit::digitizingFillColor()

QgsRubberBand *QgsMapToolEdit::createRubberBand( QgsWkbTypes::GeometryType geometryType, bool alternativeBand )
{
const QgsSettings settings;
QgsRubberBand *rb = new QgsRubberBand( mCanvas, geometryType );
rb->setWidth( digitizingStrokeWidth() );
QColor color = digitizingStrokeColor();
Expand Down
Expand Up @@ -27,8 +27,8 @@
#include "qgssettings.h"
#include "qgsvectorlayer.h"
#include "qgswkbtypes.h"
#include "qgsmapmouseevent.h"
#include "testqgsmaptoolutils.h"
#include "qgssettingsregistrycore.h"

bool operator==( const QgsGeometry &g1, const QgsGeometry &g2 )
{
Expand Down Expand Up @@ -507,7 +507,7 @@ void TestQgsMapToolAddFeatureLine::testTracingWithConvertToCurves()
const QSet<QgsFeatureId> oldFids = utils.existingFeatureIds();

// tracing enabled - without converting to curves
QgsSettings().setValue( QStringLiteral( "/qgis/digitizing/convert_to_curve" ), false );
QgsSettingsRegistryCore::settingsDigitizingConvertToCurve->setValue( false );

utils.mouseClick( 6, 1, Qt::LeftButton );
utils.mouseClick( 7, 1, Qt::LeftButton );
Expand All @@ -523,7 +523,7 @@ void TestQgsMapToolAddFeatureLine::testTracingWithConvertToCurves()
mLayerLineCurved->undoStack()->undo();

// we redo the same with convert to curves enabled
QgsSettings().setValue( QStringLiteral( "/qgis/digitizing/convert_to_curve" ), true );
QgsSettingsRegistryCore::settingsDigitizingConvertToCurve->setValue( true );

// tracing enabled - without converting to curves
utils.mouseClick( 6, 1, Qt::LeftButton );
Expand Down Expand Up @@ -552,8 +552,8 @@ void TestQgsMapToolAddFeatureLine::testTracingWithConvertToCurvesCustomTolerance
// At this distance, the arcs aren't correctly detected with the default tolerance
const double offset = 100000000; // remember to change the feature geometry accordingly in initTestCase (sic)

QgsSettings().setValue( QStringLiteral( "/qgis/digitizing/convert_to_curve_angle_tolerance" ), 1e-5 );
QgsSettings().setValue( QStringLiteral( "/qgis/digitizing/convert_to_curve_distance_tolerance" ), 1e-5 );
QgsSettingsRegistryCore::settingsDigitizingConvertToCurveAngleTolerance->setValue( 1e-5 );
QgsSettingsRegistryCore::settingsDigitizingConvertToCurveDistanceTolerance->setValue( 1e-5 );

mCanvas->setExtent( QgsRectangle( offset + 0, offset + 0, offset + 8, offset + 8 ) );
QCOMPARE( mCanvas->mapSettings().visibleExtent(), QgsRectangle( offset + 0, offset + 0, offset + 8, offset + 8 ) );
Expand All @@ -568,7 +568,7 @@ void TestQgsMapToolAddFeatureLine::testTracingWithConvertToCurvesCustomTolerance
const QSet<QgsFeatureId> oldFids = utils.existingFeatureIds();

// tracing enabled - without converting to curves
QgsSettings().setValue( QStringLiteral( "/qgis/digitizing/convert_to_curve" ), false );
QgsSettingsRegistryCore::settingsDigitizingConvertToCurve->setValue( false );

utils.mouseClick( offset + 6, offset + 1, Qt::LeftButton );
utils.mouseClick( offset + 7, offset + 1, Qt::LeftButton );
Expand All @@ -584,7 +584,7 @@ void TestQgsMapToolAddFeatureLine::testTracingWithConvertToCurvesCustomTolerance
mLayerLineCurvedOffset->undoStack()->undo();

// we redo the same with convert to curves enabled
QgsSettings().setValue( QStringLiteral( "/qgis/digitizing/convert_to_curve" ), true );
QgsSettingsRegistryCore::settingsDigitizingConvertToCurve->setValue( true );

// tracing enabled - without converting to curves
utils.mouseClick( offset + 6, offset + 1, Qt::LeftButton );
Expand Down Expand Up @@ -882,8 +882,7 @@ void TestQgsMapToolAddFeatureLine::testUndo()
void TestQgsMapToolAddFeatureLine::testStreamTolerance()
{
// test streaming mode digitizing with tolerance
QgsSettings settings;
settings.setValue( QStringLiteral( "/qgis/digitizing/stream_tolerance" ), 10 );
QgsSettingsRegistryCore::settingsDigitizingStreamTolerance->setValue( 10 );

TestQgsMapToolAdvancedDigitizingUtils utils( mCaptureTool );

Expand Down

0 comments on commit ea325a1

Please sign in to comment.