summaryrefslogtreecommitdiff
path: root/muse2/awl/sigedit.cpp
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2011-10-08 13:47:24 +0000
committerFlorian Jung <flo@windfisch.org>2011-10-08 13:47:24 +0000
commita347445db32f51562aee5c6a786c312d1f612d2f (patch)
treeba3dc9a6e03eec2edf2c213b7f4d7e5e49903edc /muse2/awl/sigedit.cpp
parent375d6a53630f364c6560eb40255a8cc4c0496b8c (diff)
parent5367067f7a36dce8a362dcc000d41ac581bffdfe (diff)
merged namespace changes. HOPEFULLY the last one.
Diffstat (limited to 'muse2/awl/sigedit.cpp')
-rw-r--r--muse2/awl/sigedit.cpp46
1 files changed, 34 insertions, 12 deletions
diff --git a/muse2/awl/sigedit.cpp b/muse2/awl/sigedit.cpp
index 74e4b060..d3685a53 100644
--- a/muse2/awl/sigedit.cpp
+++ b/muse2/awl/sigedit.cpp
@@ -43,20 +43,26 @@ SigEdit::SigEdit(QWidget* parent)
{
initialized = false;
slash = new QLabel("/",this);
- zSpin = new QSpinBox(this);
- nSpin = new QSpinBox(this);
+ zSpin = new SigSpinBox(this);
+ nSpin = new SigSpinBox(this);
zSpin->setRange(1,100);
- nSpin->setRange(1,100);
+ nSpin->setDenominator();
+ nSpin->setRange(1,128);
layout = new QHBoxLayout(this);
layout->setContentsMargins(0,0,0,0);
layout->setSpacing(1);
layout->addWidget(zSpin);
layout->addWidget(slash);
layout->addWidget(nSpin);
- layout->addSpacing(40);
+ layout->addSpacing(30);
connect(zSpin, SIGNAL(valueChanged(int)), SLOT(setZ(int)));
connect(nSpin, SIGNAL(valueChanged(int)), SLOT(setN(int)));
+ connect(nSpin, SIGNAL(returnPressed()), SIGNAL(returnPressed()));
+ connect(zSpin, SIGNAL(returnPressed()), SIGNAL(returnPressed()));
+ connect(zSpin, SIGNAL(moveFocus()), SLOT(moveFocus()));
+ connect(nSpin, SIGNAL(moveFocus()), SLOT(moveFocus()));
+ zSpin->selectAll();
}
SigEdit::~SigEdit()
@@ -68,18 +74,29 @@ SigEdit::~SigEdit()
//---------------------------------------------------------
+// moveFocus
+//---------------------------------------------------------
+
+void SigEdit::moveFocus()
+{
+ if (zSpin->hasFocus()) {
+ nSpin->setFocus();
+ nSpin->selectAll();
+ }
+ else {
+ zSpin->setFocus();
+ zSpin->selectAll();
+ }
+}
+
+//---------------------------------------------------------
// setZ
//---------------------------------------------------------
void SigEdit::setZ(const int z)
{
_sig.z=z;
- if (_sig.isValid()) {
- zSpin->setStyleSheet("");
- emit valueChanged(_sig);
- }
- else
- zSpin->setStyleSheet("QSpinBox { background-color: red; }");
+ emit valueChanged(_sig);
}
//---------------------------------------------------------
// setN
@@ -118,13 +135,18 @@ void SigEdit::updateValue()
nSpin->setValue(_sig.n);
}
- void SigEdit::paintEvent(QPaintEvent* event) {
+void SigEdit::paintEvent(QPaintEvent* event) {
if (!initialized)
updateValue();
initialized = true;
QPainter p(this);
- p.fillRect(event->rect(), Qt::white);
+ p.fillRect(event->rect(), p.background());
QWidget::paintEvent(event);
}
+void SigEdit::setFocus()
+{
+ zSpin->setFocus();
+}
+
}