always close task panel with ESC button

This commit is contained in:
wmayer
2018-09-17 21:35:44 +02:00
parent f68d65dc7b
commit 48b42c544d

View File

@@ -30,6 +30,7 @@
# include <QCursor>
# include <QPointer>
# include <QPushButton>
# include <QTimer>
#endif
#include "TaskView.h"
@@ -40,6 +41,7 @@
#include <Gui/Application.h>
#include <Gui/ViewProvider.h>
#include <Gui/Control.h>
#include <Gui/ActionFunction.h>
#if defined (QSINT_ACTIONPANEL)
#include <Gui/QSint/actionpanel/taskgroup_p.h>
@@ -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 {