[ui] Fix addition of geometryless feature not working after first click on add record toolbar action

This commit is contained in:
Mathieu Pellerin 2024-09-12 15:16:53 +07:00 committed by Nyall Dawson
parent 4344d92386
commit 39d6f8392c
4 changed files with 17 additions and 0 deletions

View File

@ -51,6 +51,8 @@ Change the layer edited by the map tool
virtual void deactivate();
virtual void reactivate();
virtual void keyPressEvent( QKeyEvent *e );

View File

@ -51,6 +51,8 @@ Change the layer edited by the map tool
virtual void deactivate();
virtual void reactivate();
virtual void keyPressEvent( QKeyEvent *e );

View File

@ -131,6 +131,18 @@ void QgsMapToolDigitizeFeature::deactivate()
emit digitizingFinished();
}
void QgsMapToolDigitizeFeature::reactivate()
{
QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( mLayer );
if ( !vlayer )
vlayer = currentVectorLayer();
if ( vlayer && vlayer->geometryType() == Qgis::GeometryType::Null )
{
layerGeometryCaptured( QgsGeometry() );
}
}
void QgsMapToolDigitizeFeature::keyPressEvent( QKeyEvent *e )
{
if ( e->key() == Qt::Key_Escape )

View File

@ -55,6 +55,7 @@ class GUI_EXPORT QgsMapToolDigitizeFeature : public QgsMapToolCaptureLayerGeomet
void activate() override;
void deactivate() override;
void reactivate() override;
// Overridden to emit digitizingCanceled when ESC is pressed
void keyPressEvent( QKeyEvent *e ) override;