From 8e9529fd272cbf58dd955841440ea28297963816 Mon Sep 17 00:00:00 2001 From: Robert Jonsson Date: Sat, 22 Oct 2011 18:38:14 +0000 Subject: merge to trunk --- muse2/muse/arranger/pcanvas.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'muse2/muse/arranger/pcanvas.cpp') diff --git a/muse2/muse/arranger/pcanvas.cpp b/muse2/muse/arranger/pcanvas.cpp index 0f2f4629..5a6e986d 100644 --- a/muse2/muse/arranger/pcanvas.cpp +++ b/muse2/muse/arranger/pcanvas.cpp @@ -68,6 +68,8 @@ //#define ABS(x) (x>=0?x:-x) #define ABS(x) (abs(x)) +#define EDITING_FINISHED_TIMEOUT 50 /* in milliseconds */ + using std::set; namespace MusEGui { @@ -181,6 +183,8 @@ void PartCanvas::returnPressed() MusEGlobal::audio->msgChangePart(oldPart, newPart, true, true, false); editMode = false; + + editingFinishedTime.start(); } } @@ -952,11 +956,14 @@ void PartCanvas::keyPress(QKeyEvent* event) // } if (editMode) { + // this will probably never happen, as edit mode has been set + // to "false" some usec ago by returnPressed, called by editingFinished. if ( key == Qt::Key_Return || key == Qt::Key_Enter ) { //returnPressed(); commented out by flo return; } + // the below CAN indeed happen. else if ( key == Qt::Key_Escape ) { lineEditor->hide(); @@ -964,6 +971,11 @@ void PartCanvas::keyPress(QKeyEvent* event) return; } } + // if returnPressed, called by editingFinished, was executed + // a short time ago, ignore this keypress if it was enter or return + if (editingFinishedTime.elapsed() < EDITING_FINISHED_TIMEOUT && + (key == Qt::Key_Return || key == Qt::Key_Enter) ) + return; if (event->modifiers() & Qt::ShiftModifier) key += Qt::SHIFT; -- cgit v1.2.3