From fe3f40fa1d24df6eda7bb9e8cd763409d4c2d655 Mon Sep 17 00:00:00 2001 From: nds Date: Tue, 20 May 2014 13:25:20 +0400 Subject: [PATCH] refs #30 - Sketch base GUI: create, draw lines "Esc" key release leads to stop any operation. --- src/PartSet/PartSet_OperationSketchBase.cpp | 12 ++++++++++++ src/PartSet/PartSet_OperationSketchBase.h | 2 +- src/PartSet/PartSet_OperationSketchLine.cpp | 5 +---- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/PartSet/PartSet_OperationSketchBase.cpp b/src/PartSet/PartSet_OperationSketchBase.cpp index 997a96b12..3a02de8b8 100644 --- a/src/PartSet/PartSet_OperationSketchBase.cpp +++ b/src/PartSet/PartSet_OperationSketchBase.cpp @@ -71,3 +71,15 @@ void PartSet_OperationSketchBase::mouseReleased(QMouseEvent* theEvent, Handle_V3 void PartSet_OperationSketchBase::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) theView) { } + +void PartSet_OperationSketchBase::keyReleased(const int theKey) +{ + switch (theKey) { + case Qt::Key_Escape: { + abort(); + } + break; + default: + break; + } +} diff --git a/src/PartSet/PartSet_OperationSketchBase.h b/src/PartSet/PartSet_OperationSketchBase.h index b11406c2d..33b9e1d04 100644 --- a/src/PartSet/PartSet_OperationSketchBase.h +++ b/src/PartSet/PartSet_OperationSketchBase.h @@ -85,7 +85,7 @@ public: /// Processes the key pressed in the view /// \param theKey a key value - virtual void keyReleased(const int theKey) {}; + virtual void keyReleased(const int theKey); signals: /// Signal about the feature construing is finished diff --git a/src/PartSet/PartSet_OperationSketchLine.cpp b/src/PartSet/PartSet_OperationSketchLine.cpp index e1c31afd1..dc67cae98 100644 --- a/src/PartSet/PartSet_OperationSketchLine.cpp +++ b/src/PartSet/PartSet_OperationSketchLine.cpp @@ -175,16 +175,13 @@ void PartSet_OperationSketchLine::mouseMoved(QMouseEvent* theEvent, Handle(V3d_V void PartSet_OperationSketchLine::keyReleased(const int theKey) { switch (theKey) { - case Qt::Key_Escape: { - abort(); - } - break; case Qt::Key_Return: { abort(); emit launchOperation(PartSet_OperationSketchLine::Type(), boost::shared_ptr()); } break; default: + PartSet_OperationSketchBase::keyReleased(theKey); break; } } -- 2.39.2