DVEvent: press key escape, abort the curent action

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3369 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2014-10-10 18:16:02 +00:00
parent 743b6768eb
commit 1a842dc263
5 changed files with 46 additions and 3 deletions

View File

@@ -22,7 +22,8 @@
DVEventInterface::DVEventInterface(DiagramView *dv) :
m_dv(dv),
m_diagram(dv->diagram()),
m_running(false)
m_running(false),
m_abort(false)
{
}
@@ -53,6 +54,26 @@ bool DVEventInterface::wheelEvent(QWheelEvent *event) {
return false;
}
/**
* @brief DVEventInterface::keyPressEvent
* By default, press escape key abort the curent action
* @param event
* @return
*/
bool DVEventInterface::keyPressEvent(QKeyEvent *event) {
if (event->key() == Qt::Key_Escape) {
m_running = false;
m_abort = true;
return true;
}
return false;
}
bool DVEventInterface::KeyReleaseEvent(QKeyEvent *event) {
Q_UNUSED (event);
return false;
}
bool DVEventInterface::isRunning() const {
return m_running;
}