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

@@ -609,6 +609,15 @@ void DiagramView::focusInEvent(QFocusEvent *e) {
mode if needed.
*/
void DiagramView::keyPressEvent(QKeyEvent *e) {
if (m_event_interface) {
if (m_event_interface -> keyPressEvent(e)) {
if (m_event_interface->isFinish()) {
emit (itemAdded());
delete m_event_interface; m_event_interface = nullptr;
}
return;
}
}
switchToVisualisationModeIfNeeded(e);
QGraphicsView::keyPressEvent(e);
}
@@ -618,6 +627,15 @@ void DiagramView::keyPressEvent(QKeyEvent *e) {
mode if needed.
*/
void DiagramView::keyReleaseEvent(QKeyEvent *e) {
if (m_event_interface) {
if (m_event_interface -> KeyReleaseEvent(e)) {
if (m_event_interface->isFinish()) {
emit (itemAdded());
delete m_event_interface; m_event_interface = nullptr;
}
return;
}
}
switchToSelectionModeIfNeeded(e);
QGraphicsView::keyReleaseEvent(e);
}