-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcollector.cpp
More file actions
29 lines (27 loc) · 842 Bytes
/
collector.cpp
File metadata and controls
29 lines (27 loc) · 842 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
#include <collector.h>
Collector::Collector(QWidget *parent) : Component(parent) {
resize(50,50);
setValue(0);
var = new QLabel(this);
var->setAlignment(Qt::AlignCenter);
var->setNum(getValue());
QVBoxLayout *l = new QVBoxLayout();
l->addWidget(var);
setLayout(l);
setComponentType(2);
}
void Collector::paintEvent(QPaintEvent*) {
var->setNum(getValue());
QPainter p(this);
p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
//p.fillRect(rect(), Qt::cyan);
QPen linePen;
linePen.setWidth(2);
linePen.setBrush(Qt::black);
linePen.setCapStyle(Qt::RoundCap);
linePen.setJoinStyle(Qt::RoundJoin);
p.setPen(linePen);
p.setBrush(Qt::cyan);
p.drawEllipse(rect().x()+1, rect().y()+1, rect().width()-2, rect().height()-2);
//p.drawEllipse(rect().x(), rect().y(), rect().width()-1, rect().height()-1);
}