summaryrefslogtreecommitdiff
path: root/muse2/muse/arranger/pcanvas.cpp
diff options
context:
space:
mode:
authorRobert Jonsson <spamatica@gmail.com>2011-10-22 18:38:14 +0000
committerRobert Jonsson <spamatica@gmail.com>2011-10-22 18:38:14 +0000
commit8e9529fd272cbf58dd955841440ea28297963816 (patch)
tree75001a184ecd559336266cad04fa0253c333d3b6 /muse2/muse/arranger/pcanvas.cpp
parentbb0f5c242c6741e3acbdbfbdb3bdb4f7dcdb37c5 (diff)
merge to trunk
Diffstat (limited to 'muse2/muse/arranger/pcanvas.cpp')
-rw-r--r--muse2/muse/arranger/pcanvas.cpp12
1 files changed, 12 insertions, 0 deletions
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;