-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathshipscale.h
More file actions
44 lines (31 loc) · 753 Bytes
/
shipscale.h
File metadata and controls
44 lines (31 loc) · 753 Bytes
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
#ifndef SHIPSCALE_H
#define SHIPSCALE_H
#include <QWidget>
#include <QPropertyAnimation>
class ShipScale : public QWidget
{
Q_OBJECT
Q_PROPERTY(int _value WRITE _setValue)
public:
ShipScale(QWidget *parent = nullptr);
void start();
void setValue(int v);
void setColor(const QColor &bgColor, const QColor &lineColor);
protected:
virtual void paintEvent(QPaintEvent *event) override;
private:
void init();
void drawCircle(QPainter &p);
void drawScale(QPainter &p);
void drawPointer(QPainter &p);
void _setValue(int v);
private slots:
void refresh();
private:
int _value;
QColor _lineColor;
QColor _bgColor;
QTimer *_t;
QPropertyAnimation *_ani;
};
#endif // SHIPSCALE_H