From d0cd33b2b832e004bafbaafb7b7ae959e576e384 Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 17 Sep 2018 21:35:44 +0200 Subject: [PATCH] always close task panel with ESC button --- src/Gui/TaskView/TaskView.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Gui/TaskView/TaskView.cpp b/src/Gui/TaskView/TaskView.cpp index 0afc54c8a2..72bc808c4e 100644 --- a/src/Gui/TaskView/TaskView.cpp +++ b/src/Gui/TaskView/TaskView.cpp @@ -30,6 +30,7 @@ # include # include # include +# include #endif #include "TaskView.h" @@ -40,6 +41,7 @@ #include #include #include +#include #if defined (QSINT_ACTIONPANEL) #include @@ -459,6 +461,17 @@ void TaskView::keyPressEvent(QKeyEvent* ke) return; } } + + // In case a task panel has no Close or Cancel button + // then invoke resetEdit() directly + // See also ViewProvider::eventCallback + Gui::TimerFunction* func = new Gui::TimerFunction(); + func->setAutoDelete(true); + Gui::Document* doc = Gui::Application::Instance->getDocument(ActiveDialog->getDocumentName().c_str()); + if (doc) { + func->setFunction(boost::bind(&Document::resetEdit, doc)); + QTimer::singleShot(0, func, SLOT(timeout())); + } } } else {