2018-12-28 18:26:18 +00:00
|
|
|
#ifndef REGIONMAPPIXMAPITEM_H
|
|
|
|
#define REGIONMAPPIXMAPITEM_H
|
|
|
|
|
2019-01-07 19:46:27 +00:00
|
|
|
#include "regionmap.h"
|
2018-12-28 18:26:18 +00:00
|
|
|
#include "tilemaptileselector.h"
|
|
|
|
#include <QGraphicsPixmapItem>
|
|
|
|
|
|
|
|
class RegionMapPixmapItem : public QObject, public QGraphicsPixmapItem {
|
|
|
|
Q_OBJECT
|
2019-08-07 04:35:02 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
using QGraphicsPixmapItem::paint;
|
|
|
|
|
2018-12-28 18:26:18 +00:00
|
|
|
public:
|
|
|
|
RegionMapPixmapItem(RegionMap *rmap, TilemapTileSelector *tile_selector) {
|
|
|
|
this->region_map = rmap;
|
|
|
|
this->tile_selector = tile_selector;
|
|
|
|
setAcceptHoverEvents(true);
|
|
|
|
}
|
2022-04-28 18:21:36 +01:00
|
|
|
RegionMap *region_map = nullptr;
|
2018-12-28 18:26:18 +00:00
|
|
|
TilemapTileSelector *tile_selector;
|
|
|
|
|
2019-08-07 04:35:02 +01:00
|
|
|
virtual void paint(QGraphicsSceneMouseEvent *);
|
2022-05-06 02:40:13 +01:00
|
|
|
virtual void fill(QGraphicsSceneMouseEvent *);
|
2019-08-07 04:35:02 +01:00
|
|
|
virtual void select(QGraphicsSceneMouseEvent *);
|
2018-12-28 18:26:18 +00:00
|
|
|
virtual void draw();
|
2022-05-06 02:40:13 +01:00
|
|
|
void floodFill(int x, int y, std::shared_ptr<TilemapTile> oldTile, std::shared_ptr<TilemapTile> newTile);
|
2018-12-28 18:26:18 +00:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void mouseEvent(QGraphicsSceneMouseEvent *, RegionMapPixmapItem *);
|
|
|
|
void hoveredRegionMapTileChanged(int x, int y);
|
|
|
|
void hoveredRegionMapTileCleared();
|
|
|
|
|
|
|
|
protected:
|
2019-08-07 04:35:02 +01:00
|
|
|
void hoverMoveEvent(QGraphicsSceneHoverEvent *);
|
|
|
|
void hoverLeaveEvent(QGraphicsSceneHoverEvent *);
|
|
|
|
void mousePressEvent(QGraphicsSceneMouseEvent *);
|
|
|
|
void mouseMoveEvent(QGraphicsSceneMouseEvent *);
|
|
|
|
void mouseReleaseEvent(QGraphicsSceneMouseEvent *);
|
2018-12-28 18:26:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // REGIONMAPPIXMAPITEM_H
|