1 #ifndef _CONTROLLER_SPIN_BOX_H
2 #define _CONTROLLER_SPIN_BOX_H 1
4 // ControllerSpinBox is like QSpinBox, except it has a second special value
5 // "PB" (in addition to the standard minimum value of -1, representing blank),
6 // representing the virtual pitch bend controller.
11 #include "shared/midi_device.h"
13 class ControllerSpinBox : public QSpinBox {
17 ControllerSpinBox(QWidget *parent) : QSpinBox(parent) {}
19 int valueFromText(const QString &text) const override
22 return MIDIReceiver::PITCH_BEND_CONTROLLER;
24 return QSpinBox::valueFromText(text);
28 QString textFromValue(int value) const override
30 if (value == MIDIReceiver::PITCH_BEND_CONTROLLER) {
33 return QSpinBox::textFromValue(value);
37 QValidator::State validate(QString &input, int &pos) const override
40 return QValidator::Acceptable;
42 return QSpinBox::validate(input, pos);
47 #endif // !defined(_CONTROLLER_SPIN_BOX_H)