porymap/include/ui/regionmappixmapitem.h

43 lines
1.3 KiB
C
Raw Normal View History

#ifndef REGIONMAPPIXMAPITEM_H
#define REGIONMAPPIXMAPITEM_H
#include "regionmap.h"
#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;
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;
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 *);
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);
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 *);
};
#endif // REGIONMAPPIXMAPITEM_H