Skip to content

Commit

Permalink
Do not uncheck the QAction when tool is still active
Browse files Browse the repository at this point in the history
  • Loading branch information
YoannQDQ committed Dec 17, 2024
1 parent 2ab8629 commit c4b9209
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/app/qgsmaptooltrimextendfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,13 +278,13 @@ void QgsMapToolTrimExtendFeature::canvasReleaseEvent( QgsMapMouseEvent *e )

// If Shift is pressed, keep the tool active with its reference feature
if ( !( e->modifiers() & Qt::ShiftModifier ) )
deactivate();
reset();
break;
}
}
else if ( e->button() == Qt::RightButton )
{
deactivate();
reset();
}
}

Expand All @@ -297,7 +297,7 @@ void QgsMapToolTrimExtendFeature::keyPressEvent( QKeyEvent *e )

if ( e && e->key() == Qt::Key_Escape )
{
deactivate();
reset();
}
}

Expand Down Expand Up @@ -363,8 +363,7 @@ void QgsMapToolTrimExtendFeature::extendLimit()
mRubberBandLimitExtend->setToGeometry( geom, refLayer );
mRubberBandLimitExtend->show();
}

void QgsMapToolTrimExtendFeature::deactivate()
void QgsMapToolTrimExtendFeature::reset()
{
mStep = StepLimit;
mIsModified = false;
Expand All @@ -375,7 +374,11 @@ void QgsMapToolTrimExtendFeature::deactivate()
mRubberBandLimitExtend.reset();
mRubberBandExtend.reset();
mRubberBandIntersection.reset();
QgsMapTool::deactivate();
mVlayer = nullptr;
mLimitLayer = nullptr;
}
void QgsMapToolTrimExtendFeature::deactivate()
{
reset();
QgsMapTool::deactivate();
}
1 change: 1 addition & 0 deletions src/app/qgsmaptooltrimextendfeature.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class APP_EXPORT QgsMapToolTrimExtendFeature : public QgsMapToolEdit
private slots:
// Recompute the extended limit
void extendLimit();
void reset();

private:
//! Rubberband that highlights the limit segment
Expand Down

0 comments on commit c4b9209

Please sign in to comment.