blob: f78229867a22f17abddfeae50b6198dfc621ad17 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#ifndef WBEATSPINBOX_H
#define WBEATSPINBOX_H
#include "control/controlobject.h"
#include "control/controlproxy.h"
#include "widget/wbasewidget.h"
#include "skin/skincontext.h"
#include <QDoubleSpinBox>
#include <QLineEdit>
class ControlProxy;
class WBeatSpinBox : public QDoubleSpinBox, public WBaseWidget {
Q_OBJECT
public:
WBeatSpinBox(QWidget* parent, const ConfigKey& configKey, int decimals = 5,
double minimum = 0.03125, double maximum = 512.00);
void setup(const QDomNode& node, const SkinContext& context);
private slots:
void slotSpinboxValueChanged(double newValue);
void slotControlValueChanged(double newValue);
QString textFromValue(double value) const override;
double valueFromText(const QString& text) const override;
QValidator::State validate(QString& input, int& pos) const override;
private:
void stepBy(int steps) override;
QString fractionString(int numerator, int denominator) const;
ControlProxy m_valueControl;
static QRegExp s_regexpBlacklist;
// for font scaling
bool event(QEvent* pEvent) override;
double m_scaleFactor;
};
// This is an inherited class that supports font scaling
class WBeatLineEdit : public QLineEdit {
Q_OBJECT
public:
explicit WBeatLineEdit(QWidget* parent=0)
: QLineEdit(parent),
m_scaleFactor(1.0) {
}
void setScaleFactor(double scaleFactor) {
m_scaleFactor = scaleFactor;
}
private:
bool event(QEvent* pEvent) override;
double m_scaleFactor;
};
#endif
|