summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--muse2/ChangeLog2
-rw-r--r--muse2/muse/arranger/pcanvas.cpp12
-rw-r--r--muse2/muse/arranger/pcanvas.h3
-rw-r--r--muse2/muse/widgets/spinbox.cpp15
-rw-r--r--muse2/muse/widgets/spinbox.h3
5 files changed, 34 insertions, 1 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog
index fa26cc93..bf5172f9 100644
--- a/muse2/ChangeLog
+++ b/muse2/ChangeLog
@@ -1,3 +1,5 @@
+22.10.2010:
+ - Catch return in spin boxes and move focus away (rj)
20.10.2011:
- Added missing triplets in quantisation dialog (rj)
16.10.2011:
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;
diff --git a/muse2/muse/arranger/pcanvas.h b/muse2/muse/arranger/pcanvas.h
index 8a108055..cda2632d 100644
--- a/muse2/muse/arranger/pcanvas.h
+++ b/muse2/muse/arranger/pcanvas.h
@@ -26,6 +26,7 @@
#include <QVector>
#include <set>
+#include <QTime>
#include "song.h"
#include "canvas.h"
@@ -93,6 +94,8 @@ class PartCanvas : public Canvas {
NPart* editPart;
int curColorIndex;
bool editMode;
+
+ QTime editingFinishedTime;
AutomationObject automation;
diff --git a/muse2/muse/widgets/spinbox.cpp b/muse2/muse/widgets/spinbox.cpp
index f7afcf2a..a763eea1 100644
--- a/muse2/muse/widgets/spinbox.cpp
+++ b/muse2/muse/widgets/spinbox.cpp
@@ -99,4 +99,19 @@ void SpinBox::stepDown()
_clearFocus = true;
}
+void SpinBox::keyPressEvent(QKeyEvent* ev)
+{
+ switch (ev->key()) {
+ case Qt::Key_Return:
+ clearFocus();
+ //emit returnPressed();
+ // return;
+ break;
+ default:
+ break;
+ }
+ QSpinBox::keyPressEvent(ev);
+}
+
} // namespace MusEGui
+
diff --git a/muse2/muse/widgets/spinbox.h b/muse2/muse/widgets/spinbox.h
index cee112d4..cd37fb32 100644
--- a/muse2/muse/widgets/spinbox.h
+++ b/muse2/muse/widgets/spinbox.h
@@ -43,7 +43,8 @@ class SpinBox : public QSpinBox {
protected:
bool eventFilter(QObject* obj, QEvent* ev);
-
+ virtual void keyPressEvent(QKeyEvent*);
+
public slots:
virtual void stepUp();
virtual void stepDown();