forked from WXLmjr/VirtualOscilloscope_Qt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
knob.h
39 lines (27 loc) · 757 Bytes
/
knob.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
#ifndef _KNOB_H_
#define _KNOB_H_
#include <qwidget.h>
class QwtKnob;
class QLabel;
class Knob: public QWidget //继承自QWidget的旋钮类
{
Q_OBJECT
Q_PROPERTY( QColor theme READ theme WRITE setTheme )
public:
Knob( const QString &title,
double min, double max, QWidget *parent = NULL );
virtual QSize sizeHint() const;
void setValue( double value );
double value() const;
void setTheme( const QColor & );
QColor theme() const;
Q_SIGNALS:
double valueChanged( double );
protected:
virtual void resizeEvent( QResizeEvent * );
//将一个QwtKnob(旋钮类)和一个QLabel(标签类)组合成一个Knob类
private:
QwtKnob *d_knob;
QLabel *d_label;
};
#endif