-
Notifications
You must be signed in to change notification settings - Fork 3
/
tile.cpp
40 lines (39 loc) · 2.14 KB
/
tile.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
/************************************************************************************
* QSlippyMap - Tile based slippery map *
* Copyright (C) 2017 Michael Carpenter (malcom2073@gmail.com) *
* *
* This file is a part of QSlippyMap *
* *
* QSlippyMap is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *
* License as published by the Free Software Foundation, version *
* 2.1 of the License. *
* *
* QSlippyMap is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
************************************************************************************/
#include "tile.h"
#include <QPainter>
Tile::Tile(QGraphicsItem *parent) : QGraphicsItem(parent)
{
}
void Tile::setImage(QImage image,int x,int y)
{
m_image = image;
this->setPos(x * 256,y * 256);
}
void Tile::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
painter->drawImage(0,0,m_image);
}
QRectF Tile::boundingRect() const
{
return QRectF(0,0,m_image.width(),m_image.height());
//return QRectF(-0.5,-0.5,1,1);
}