summaryrefslogtreecommitdiff
path: root/muse2/awl/sigspinbox.cpp
diff options
context:
space:
mode:
authorRobert Jonsson <spamatica@gmail.com>2011-10-06 19:59:32 +0000
committerRobert Jonsson <spamatica@gmail.com>2011-10-06 19:59:32 +0000
commit42039e7f7f215f6008829d8c6be591c998f1228c (patch)
tree58b1e58150134e83d17c5fd2a7bfe1274b4f7084 /muse2/awl/sigspinbox.cpp
parentb936d9e9af142158c01d984d4fc9c47717148a35 (diff)
more SigEdit
Diffstat (limited to 'muse2/awl/sigspinbox.cpp')
-rw-r--r--muse2/awl/sigspinbox.cpp47
1 files changed, 25 insertions, 22 deletions
diff --git a/muse2/awl/sigspinbox.cpp b/muse2/awl/sigspinbox.cpp
index 5ee98bc9..6e38b164 100644
--- a/muse2/awl/sigspinbox.cpp
+++ b/muse2/awl/sigspinbox.cpp
@@ -13,34 +13,13 @@ void SigSpinBox::keyPressEvent(QKeyEvent*ev)
switch (ev->key()) {
case Qt::Key_Return:
emit returnPressed();
+ return;
break;
case Qt::Key_Left:
case Qt::Key_Right:
case Qt::Key_Slash:
emit moveFocus();
- break;
- case Qt::Key_Up:
- if (_denominator) {
- // make sure that sig is valid then increase
- AL::TimeSignature sig(4,value());
- if (sig.isValid())
- setValue(value()*2);
- return;
- }
- break;
- case Qt::Key_Down:
- if (_denominator) {
- // make sure that sig is valid then increase
- AL::TimeSignature sig(4,value());
- if (sig.isValid()) {
- int v = value()/2;
- if (v<2)
- v=2;
- setValue(v);
- return;
- }
return;
- }
break;
default:
break;
@@ -52,3 +31,27 @@ void SigSpinBox::setDenominator()
{
_denominator=true;
}
+
+void SigSpinBox::stepBy(int step)
+{
+ if (!_denominator) {
+ setValue(value() + step);
+ return;
+ }
+
+ AL::TimeSignature sig(4, value());
+ if (step == 1) {
+ // make sure that sig is valid then increase
+ if (sig.isValid())
+ setValue(value() * 2);
+ }
+ else if (step == -1) {
+ // make sure that sig is valid then increase
+ if (sig.isValid()) {
+ int v = value() / 2;
+ if (v < 2)
+ v = 2;
+ setValue(v);
+ }
+ }
+}