-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdots.cpp
More file actions
46 lines (40 loc) · 1.12 KB
/
Copy pathdots.cpp
File metadata and controls
46 lines (40 loc) · 1.12 KB
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
#include "Dots.h"
Dots::Dots(const QVector<QPoint>* points) :
maxDots(points->length())
{
setPoints(points);
// Load dot images
dotImg.load("://Images/timdots.png");
largeDotImg.load("://Images/gabedots.png");
}
QRectF Dots::boundingRect() const
{
return QRect(0,0,dotW,dotH);
}
void Dots::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
for (QPoint point : points)
{
// Location for power dots (large dots)
if ((point.x() == 10 && point.y() == 50) ||
(point.x() == 510 && point.y() == 50) ||
(point.x() == 10 && point.y() == 450) ||
(point.x() == 510 && point.y() == 450) )
{
painter->drawPixmap(point.x(), point.y(), dotW, dotH, largeDotImg);
}
// Regular dots
else
{
painter->drawPixmap(point.x(), point.y(), dotW, dotH, dotImg);
}
}
}
void Dots::setPoints(const QVector<QPoint>* points)
{
this->points.clear(); // Clears current points to reset map
if (!points->isEmpty())
{
this->points = *points;
}
}