summaryrefslogtreecommitdiff
path: root/muse2/awl
diff options
context:
space:
mode:
Diffstat (limited to 'muse2/awl')
-rw-r--r--muse2/awl/posedit.cpp1
-rw-r--r--muse2/awl/posedit.h3
-rw-r--r--muse2/awl/sigedit.cpp5
-rw-r--r--muse2/awl/sigedit.h5
-rw-r--r--muse2/awl/sigspinbox.cpp10
-rw-r--r--muse2/awl/sigspinbox.h1
6 files changed, 18 insertions, 7 deletions
diff --git a/muse2/awl/posedit.cpp b/muse2/awl/posedit.cpp
index 049b59bd..cc4062ef 100644
--- a/muse2/awl/posedit.cpp
+++ b/muse2/awl/posedit.cpp
@@ -115,6 +115,7 @@ bool PosEdit::event(QEvent* event)
// choose to clear it in their constructor."
// Just to be sure. Otherwise escape will close a midi editor for example, which is annoying.
ke->setAccepted(true);
+ emit escapePressed();
return true;
}
diff --git a/muse2/awl/posedit.h b/muse2/awl/posedit.h
index 29692124..65bc48de 100644
--- a/muse2/awl/posedit.h
+++ b/muse2/awl/posedit.h
@@ -60,8 +60,9 @@ class PosEdit : public QAbstractSpinBox
signals:
void valueChanged(const MusECore::Pos&);
- // Choose these three carefully, watch out for focusing recursion.
+ // Choose these carefully, watch out for focusing recursion.
void returnPressed();
+ void escapePressed();
void lostFocus();
// This is emitted when focus lost or return pressed (same as QAbstractSpinBox).
void editingFinished();
diff --git a/muse2/awl/sigedit.cpp b/muse2/awl/sigedit.cpp
index bbe96d61..70b60a74 100644
--- a/muse2/awl/sigedit.cpp
+++ b/muse2/awl/sigedit.cpp
@@ -45,6 +45,8 @@ SigEdit::SigEdit(QWidget* parent)
slash = new QLabel("/",this);
zSpin = new SigSpinBox(this);
nSpin = new SigSpinBox(this);
+ zSpin->setFocusPolicy(Qt::StrongFocus);
+ nSpin->setFocusPolicy(Qt::StrongFocus);
zSpin->setRange(1,100);
nSpin->setDenominator();
nSpin->setRange(1,128);
@@ -58,6 +60,8 @@ SigEdit::SigEdit(QWidget* parent)
connect(nSpin, SIGNAL(valueChanged(int)), SLOT(setN(int)));
connect(nSpin, SIGNAL(returnPressed()), SIGNAL(returnPressed()));
connect(zSpin, SIGNAL(returnPressed()), SIGNAL(returnPressed()));
+ connect(nSpin, SIGNAL(escapePressed()), SIGNAL(escapePressed()));
+ connect(zSpin, SIGNAL(escapePressed()), SIGNAL(escapePressed()));
connect(zSpin, SIGNAL(moveFocus()), SLOT(moveFocus()));
connect(nSpin, SIGNAL(moveFocus()), SLOT(moveFocus()));
@@ -71,7 +75,6 @@ SigEdit::~SigEdit()
delete nSpin;
}
-
//---------------------------------------------------------
// moveFocus
//---------------------------------------------------------
diff --git a/muse2/awl/sigedit.h b/muse2/awl/sigedit.h
index 5fe8186d..bfe381ac 100644
--- a/muse2/awl/sigedit.h
+++ b/muse2/awl/sigedit.h
@@ -44,7 +44,7 @@ namespace Awl {
class SigEdit : public QWidget
{
Q_OBJECT
-
+
AL::TimeSignature _sig;
bool initialized;
QLabel *slash;
@@ -58,6 +58,7 @@ class SigEdit : public QWidget
signals:
void valueChanged(const AL::TimeSignature&);
void returnPressed();
+ void escapePressed();
private slots:
void setN(const int n);
@@ -71,8 +72,8 @@ class SigEdit : public QWidget
public:
SigEdit(QWidget* parent = 0);
~SigEdit();
-
AL::TimeSignature sig() const { return _sig; }
+ void setFrame(bool v) { zSpin->setFrame(v); nSpin->setFrame(v); }
};
}
diff --git a/muse2/awl/sigspinbox.cpp b/muse2/awl/sigspinbox.cpp
index f1399538..f3cbe06d 100644
--- a/muse2/awl/sigspinbox.cpp
+++ b/muse2/awl/sigspinbox.cpp
@@ -8,8 +8,7 @@
class MyLineEdit : public QLineEdit
{
public:
- MyLineEdit() : QLineEdit() {};
- MyLineEdit(QWidget* parent) : QLineEdit(parent) {};
+ MyLineEdit(QWidget* parent = 0) : QLineEdit(parent) {};
protected:
virtual void mousePressEvent (QMouseEvent* e)
@@ -19,10 +18,10 @@ class MyLineEdit : public QLineEdit
}
};
-
SigSpinBox::SigSpinBox(QWidget *parent) :
QSpinBox(parent)
{
+ setKeyboardTracking(false);
_denominator=false;
setLineEdit(new MyLineEdit(this));
}
@@ -31,9 +30,14 @@ void SigSpinBox::keyPressEvent(QKeyEvent* ev)
{
switch (ev->key()) {
case Qt::Key_Return:
+ QSpinBox::keyPressEvent(ev);
emit returnPressed();
return;
break;
+ case Qt::Key_Escape:
+ emit escapePressed();
+ return;
+ break;
case Qt::Key_Left:
case Qt::Key_Right:
case Qt::Key_Slash:
diff --git a/muse2/awl/sigspinbox.h b/muse2/awl/sigspinbox.h
index 92fd1cbc..50299338 100644
--- a/muse2/awl/sigspinbox.h
+++ b/muse2/awl/sigspinbox.h
@@ -16,6 +16,7 @@ public:
signals:
void returnPressed();
+ void escapePressed();
void moveFocus();
public slots: