porymap/include/ui/citymappixmapitem.h

42 lines
967 B
C
Raw Normal View History

2019-01-05 22:59:57 +00:00
#ifndef CITYMAPPIXMAPITEM_H
#define CITYMAPPIXMAPITEM_H
#include "tilemaptileselector.h"
#include <QGraphicsPixmapItem>
#include <QByteArray>
class CityMapPixmapItem : public QObject, public QGraphicsPixmapItem {
Q_OBJECT
public:
CityMapPixmapItem(QString fname, TilemapTileSelector *tile_selector) {
this->file = fname;
this->tile_selector = tile_selector;
setAcceptHoverEvents(true);
init();
}
TilemapTileSelector *tile_selector;
QString file;
int width;
int height;
QByteArray data;
void init();
void save();
void create(QString);
virtual void paint(QGraphicsSceneMouseEvent*);
virtual void draw();
signals:
void mouseEvent(QGraphicsSceneMouseEvent *, CityMapPixmapItem *);
void hoveredRegionMapTileChanged(int x, int y);
void hoveredRegionMapTileCleared();
protected:
void mousePressEvent(QGraphicsSceneMouseEvent*);
};
#endif // CITYMAPPIXMAPITEM_H