-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwicket.cpp
More file actions
51 lines (38 loc) · 963 Bytes
/
wicket.cpp
File metadata and controls
51 lines (38 loc) · 963 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
45
46
47
48
49
50
51
#include "wicket.h"
Wicket::Wicket()
{
}
void Wicket::setType(int Type)
{
myType = Type;
}
void Wicket::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
QPen myPen(Qt::black, 2, Qt::SolidLine, Qt::SquareCap, Qt::MiterJoin);
painter->setBrush(Qt::lightGray);
painter->setPen(myPen);
switch (myType) {
case 0:
{
painter->drawRect(0, 0, 50, 50);
painter->drawLine(25, 0, 25, 25);
painter->drawLine(0, 50, 25, 25);
painter->drawLine(50, 50, 25, 25);
}
break;
case 1:
{
painter->drawRect(0, 0, 50, 50);
painter->drawLine(0, 25, 50, 0);
painter->drawLine(0, 25, 50, 50);
}
break;
case 2:
{
painter->drawRect(0, 0, 50, 50);
painter->drawEllipse(0, 0, 50, 25);
painter->drawLine(25, 0, 25, 50);
}
break;
}
}