-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtip.cpp
More file actions
30 lines (26 loc) · 744 Bytes
/
tip.cpp
File metadata and controls
30 lines (26 loc) · 744 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
#include "tip.h"
#include "gamecontroller.h"
#include <QPainter>
Tip::Tip(GameController &controller):
controller(controller)
{
setData(GD_type, GO_Tip);
pixMap.load("://images/Tip.png");
setPos(-15, viewHeight-pixMap.height()+5);
setZValue(2);
}
QRectF Tip::boundingRect() const
{
int w = pixMap.width(), h = pixMap.height();
return QRectF(0, 0, w, h);
}
void Tip::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
Q_UNUSED(option); Q_UNUSED(widget);
if(!pixMap.isNull()) {
painter->save();
int w = pixMap.width(), h = pixMap.height();
painter->drawPixmap(QPoint(0, 0), pixMap);
painter->restore();
}
}