-
Notifications
You must be signed in to change notification settings - Fork 51
/
labelledslider.h
54 lines (40 loc) · 1.26 KB
/
labelledslider.h
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
/** Copyright (c) 2013, Sean Kasun */
#ifndef LABELLEDSLIDER_H_
#define LABELLEDSLIDER_H_
#include <QWidget>
#include <QSlider>
#include <QLabel>
#include <QWheelEvent>
#include <QKeyEvent>
class MSlider : public QSlider {
Q_OBJECT
public:
explicit MSlider(Qt::Orientation orientation, QWidget *parent = 0);
public slots:
void wheelEvent(QWheelEvent *event);
};
class LabelledSlider : public QWidget {
Q_OBJECT
public:
explicit LabelledSlider(Qt::Orientation orientation, QWidget *parent = 0);
int value() const;
signals:
void valueChanged(int val);
public slots:
void setValue(double val); // set absolute value
void changeValue(double val); // change value relative to current
void setRange(int minVal, int maxVal); // set slider range
void setMinimum(int minVal); // set slider range minimum
void setMaximum(int maxVal); // set slider range maximum
int minimum() const; // get slider range minimum
int maximum() const; // get slider range maximum
private slots:
void intValueChange(int val);
protected:
void wheelEvent(QWheelEvent *event);
private:
MSlider *slider;
QLabel *label;
double preciseValue;
};
#endif // LABELLEDSLIDER_H_