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
This commit is contained in:
wwmayer
2025-09-22 16:16:26 +02:00
committed by Chris Hennes
parent e22c569282
commit 14cd0002e5

View File

@@ -23,6 +23,7 @@
# include <QApplication>
# include <QKeyEvent>
# include <QTimer>
# include <Inventor/SoPickedPoint.h>
# include <Inventor/actions/SoGetBoundingBoxAction.h>
@@ -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]() {