-
Notifications
You must be signed in to change notification settings - Fork 1
/
legendagraphicsitem.cpp
66 lines (52 loc) · 1.94 KB
/
legendagraphicsitem.cpp
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
55
56
57
58
59
60
61
62
63
64
65
66
#include "legendagraphicsitem.h"
#include <QPainter>
#include <QPen>
#include <QBrush>
#include <QStyleOptionGraphicsItem>
namespace DJ {
namespace View {
LegendaGraphicsItem::LegendaGraphicsItem(QGraphicsItem *parent)
: QObject(),
QGraphicsItem(parent) {
QFont font("Courier new");
font.setPixelSize(26);
font.setBold(true);
this->setCacheMode(DeviceCoordinateCache);
this->solvedText = new QGraphicsSimpleTextItem("Solved Problem", this);
this->solvedText->setPos(55, 15);
this->solvedText->setPen(QPen(Qt::black));
this->solvedText->setBrush(QBrush(Qt::white));
this->solvedText->setFont(font);
this->rejectedText = new QGraphicsSimpleTextItem("Rejected Run(s)", this);
this->rejectedText->setPos(55, 55);
this->rejectedText->setPen(QPen(Qt::black));
this->rejectedText->setBrush(QBrush(Qt::white));
this->rejectedText->setFont(font);
this->pendingText = new QGraphicsSimpleTextItem("Pending Submission", this);
this->pendingText->setPos(55, 95);
this->pendingText->setPen(QPen(Qt::black));
this->pendingText->setBrush(QBrush(Qt::white));
this->pendingText->setFont(font);
}
QRectF LegendaGraphicsItem::boundingRect() const {
return QRectF(0, 0, 380, 135);
}
void LegendaGraphicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *) {
painter->setClipRect(option->exposedRect);
painter->setPen(Qt::white);
painter->setBrush(QColor(0, 0, 0, 180));
painter->drawRoundedRect(1, 1, 378, 133, 10, 10);
painter->setPen(Qt::NoPen);
QColor green(97, 235, 0);
painter->setBrush(green);
painter->drawRoundedRect(15, 15, 25, 25, 6, 6);
QColor red(221, 5, 10);
painter->setBrush(red);
painter->drawRoundedRect(15, 55, 25, 25, 6, 6);
QColor yellow(248, 228, 0);
painter->setBrush(yellow);
painter->drawRoundedRect(15, 95, 25, 25, 6, 6);
}
} // namespace View
} // namespace DJ