Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 d114a69
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/app/maptools/qgsmaptoolsdigitizingtechniquemanager.h
Expand Up @@ -23,6 +23,8 @@
#include "qgssettingsentryenumflag.h"
#include "qgsmaptoolcapture.h"
#include "qgsmaptoolshapeabstract.h"
#include "qgsmaptoolshapecircle2points.h"


#include <QWidgetAction>

Expand Down Expand Up @@ -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();
Expand Down
2 changes: 0 additions & 2 deletions src/app/maptools/qgsmaptoolshapecircle2points.cpp
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/app/maptools/qgsmaptoolshapecircle2points.h
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/gui/qgsmaptoolcapture.cpp
Expand Up @@ -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 );
}
}

Expand Down

0 comments on commit d114a69

Please sign in to comment.