Skip to content
Permalink
Browse files
set circle as default shape tool
also fix crash if called without shape metadata

fixes #47648
  • Loading branch information
3nids authored and nyalldawson committed Aug 21, 2022
1 parent b572e9e commit d114a69a6f9c2b422498c5d3319f4a6a3b0ce416
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
@@ -23,6 +23,8 @@
#include "qgssettingsentryenumflag.h"
#include "qgsmaptoolcapture.h"
#include "qgsmaptoolshapeabstract.h"
#include "qgsmaptoolshapecircle2points.h"


#include <QWidgetAction>

@@ -53,7 +55,7 @@ class APP_EXPORT QgsMapToolsDigitizingTechniqueManager : public QObject
static const inline QgsSettingsEntryEnumFlag<Qgis::CaptureTechnique> settingsDigitizingTechnique = QgsSettingsEntryEnumFlag<Qgis::CaptureTechnique>( QStringLiteral( "technique" ), QgsSettings::Prefix::QGIS_DIGITIZING, Qgis::CaptureTechnique::StraightSegments, QObject::tr( "Current digitizing technique" ), Qgis::SettingsOption::SaveFormerValue ) SIP_SKIP;

static const inline QgsSettingsEntryString settingMapToolShapeDefaultForShape = QgsSettingsEntryString( QStringLiteral( "%1/default" ), QgsSettings::Prefix::QGIS_DIGITIZING_SHAPEMAPTOOLS, QString(), QObject::tr( "Default map tool for given shape category" ) ) SIP_SKIP;
static const inline QgsSettingsEntryString settingMapToolShapeCurrent = QgsSettingsEntryString( QStringLiteral( "current" ), QgsSettings::Prefix::QGIS_DIGITIZING_SHAPEMAPTOOLS, QString(), QObject::tr( "Current shape map tool" ) ) SIP_SKIP;
static const inline QgsSettingsEntryString settingMapToolShapeCurrent = QgsSettingsEntryString( QStringLiteral( "current" ), QgsSettings::Prefix::QGIS_DIGITIZING_SHAPEMAPTOOLS, QgsMapToolShapeCircle2PointsMetadata::TOOL_ID, QObject::tr( "Current shape map tool" ) ) SIP_SKIP;

QgsMapToolsDigitizingTechniqueManager( QObject *parent );
~QgsMapToolsDigitizingTechniqueManager();
@@ -21,8 +21,6 @@
#include "qgsmaptoolcapture.h"
#include "qgsapplication.h"

const QString QgsMapToolShapeCircle2PointsMetadata::TOOL_ID = QStringLiteral( "circle-from-2-points" );

QString QgsMapToolShapeCircle2PointsMetadata::id() const
{
return QgsMapToolShapeCircle2PointsMetadata::TOOL_ID;
@@ -29,7 +29,7 @@ class APP_EXPORT QgsMapToolShapeCircle2PointsMetadata : public QgsMapToolShapeMe
: QgsMapToolShapeMetadata()
{}

static const QString TOOL_ID;
static const inline QString TOOL_ID = QStringLiteral( "circle-from-2-points" );

QString id() const override;
QString name() const override;
@@ -451,7 +451,8 @@ void QgsMapToolCapture::setCurrentShapeMapTool( const QgsMapToolShapeMetadata *s
if ( mCurrentCaptureTechnique == Qgis::CaptureTechnique::Shape && isActive() )
{
clean();
mCurrentShapeMapTool->activate( mCaptureMode, mCaptureLastPoint );
if ( mCurrentShapeMapTool )
mCurrentShapeMapTool->activate( mCaptureMode, mCaptureLastPoint );
}
}

0 comments on commit d114a69

Please sign in to comment.