From 14cd0002e52b42d50572b91f2f5108fd92db558d Mon Sep 17 00:00:00 2001 From: wwmayer Date: Mon, 22 Sep 2025 16:16:26 +0200 Subject: [PATCH] Gui: Do not accept changes when pressing ESC key in 3D view Forward the ESC key event to the Task view to reject changes if needed. This fixes issue https://github.com/FreeCAD/FreeCAD/issues/23504 --- src/Gui/ViewProvider.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Gui/ViewProvider.cpp b/src/Gui/ViewProvider.cpp index f1a32892ac..a20244c560 100644 --- a/src/Gui/ViewProvider.cpp +++ b/src/Gui/ViewProvider.cpp @@ -23,6 +23,7 @@ # include +# include # include # include # include @@ -48,6 +49,7 @@ #include "Application.h" #include "BitmapFactory.h" #include "Document.h" +#include "DockWindowManager.h" #include "SoFCDB.h" #include "View3DInventor.h" #include "View3DInventorViewer.h" @@ -234,6 +236,12 @@ void ViewProvider::eventCallback(void * ud, SoEventCallback * node) } } + DockWindowManager* pDockMgr = DockWindowManager::instance(); + if (QWidget* widget = pDockMgr->getDockWindow("Tasks")) { + QKeyEvent ev(QEvent::KeyPress, Qt::Key_Escape, Qt::NoModifier); + qApp->sendEvent(widget, &ev); + } + auto func = new Gui::TimerFunction(); func->setAutoDelete(true); func->setFunction([doc]() {