diff options
Diffstat (limited to 'muse2/muse/widgets/spinbox.cpp')
-rw-r--r-- | muse2/muse/widgets/spinbox.cpp | 48 |
1 files changed, 1 insertions, 47 deletions
diff --git a/muse2/muse/widgets/spinbox.cpp b/muse2/muse/widgets/spinbox.cpp index aa536809..ee585da7 100644 --- a/muse2/muse/widgets/spinbox.cpp +++ b/muse2/muse/widgets/spinbox.cpp @@ -5,10 +5,8 @@ // (C) Copyright 2001 Werner Schweer (ws@seh.de) //========================================================= -#include <QEvent> #include <QKeyEvent> -#include <QMouseEvent> - +#include <QEvent> #include "spinbox.h" //--------------------------------------------------------- @@ -27,52 +25,8 @@ SpinBox::SpinBox(int minValue, int maxValue, int step, QWidget* parent) setRange(minValue, maxValue); setSingleStep(step); _clearFocus = true; - upEnabled = StepUpEnabled; - downEnabled = StepDownEnabled; -} - -QAbstractSpinBox::StepEnabled SpinBox::stepEnabled() const -{ - return upEnabled | downEnabled; } -void SpinBox::setStepEnabled(bool up, bool down) -{ - upEnabled = up ? StepUpEnabled : StepNone; - downEnabled = down ? StepDownEnabled : StepNone; -} - -int SpinBox::arrowWidth() const -{ - QStyleOptionSpinBox styleOpt; - styleOpt.initFrom(this); - QRect upArrowRect = QApplication::style()->subControlRect(QStyle::CC_SpinBox, &styleOpt, QStyle::SC_SpinBoxUp, this); - return upArrowRect.width(); -} - -void SpinBox::setEditor(QLineEdit* ed) -{ - setLineEdit(ed); -} - -void SpinBox::mousePressEvent ( QMouseEvent * event ) -{ - // FIXME: I couldn't find a way to access the arrow buttons directly. Hence I am using a QRect::contains method. - // Unfortunately this is not 100% accurate with the Oxygen style; one needs to push to the right hand side of the - // buttons. But it works perfect with the QtCurve style - Orcan - QStyleOptionSpinBox styleOpt; - styleOpt.initFrom(this); - QRect upArrowRect = QApplication::style()->subControlRect(QStyle::CC_SpinBox, &styleOpt, QStyle::SC_SpinBoxUp, this); - QRect downArrowRect = QApplication::style()->subControlRect(QStyle::CC_SpinBox, &styleOpt, QStyle::SC_SpinBoxDown, this); - - if (upArrowRect.contains(event->pos())) - emit(stepUpPressed()); - else if (downArrowRect.contains(event->pos())) - emit(stepDownPressed()); - QSpinBox::mousePressEvent(event); -} - - bool SpinBox::eventFilter(QObject* o, QEvent* ev) { // if (o != (QObject*)editor()) ddskrjo can't find editor() |