blob: 10344f77059ef4426389ee5194c6728abb5ab745 (
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
|
#ifndef CARDSSTATUSBAR_H
#define CARDSSTATUSBAR_H
#include <QtWidgets>
class CardsStatusBar : public QWidget
{
Q_OBJECT
public:
static const QStringList Colors;
public:
CardsStatusBar(QWidget* aParent = 0);
~CardsStatusBar();
void setValues(const QList<int>& values) { this->values = values; update(); }
protected:
virtual void paintEvent(QPaintEvent* aEvent);
private:
int getMax() const;
void drawSection(int index);
QLinearGradient getSectionGradient(int index);
QRectF getSectionRect(int index);
private:
static const int Radius = 6;
private:
QList<int> values;
qreal max;
QRectF barRect;
QPainter* painter;
qreal sectionLeft;
};
#endif
|