Sketcher: Handling of ESC keypress during handler execution

===========================================================

Instead of terminating the handler, as mandated before this PR by ViewProviderSketch, ViewProviderSketch
delegates the action to DrawSketchHandler.

DrawSketchHandler implements by default this terminating behaviour, but allows to override it.

DrawSketchDefaultHandler (and all tools deriving from it) implement as default behaviour to cancel if
in initial state, otherwise to reset.
This commit is contained in:
Abdullah Tahiri
2023-11-05 08:20:02 +01:00
committed by abdullahtahiriyo
parent fc472601e4
commit 9cb6fa0df7
5 changed files with 26 additions and 4 deletions

View File

@@ -26,6 +26,8 @@
#include <QGuiApplication>
#include <QPainter>
#include <Inventor/events/SoKeyboardEvent.h>
#endif // #ifndef _PreComp_
#include <Base/Console.h>
@@ -367,6 +369,15 @@ void DrawSketchHandler::toolWidgetChanged(QWidget* newwidget)
onWidgetChanged();
}
void DrawSketchHandler::registerPressedKey(bool pressed, int key)
{
// the default behaviour is to quit - specific handler categories may
// override this behaviour, for example to implement a continuous mode
if (key == SoKeyboardEvent::ESCAPE && !pressed) {
quit();
}
}
//**************************************************************************
// Helpers