porymap/include/ui/bordermetatilespixmapitem.h

36 lines
1 KiB
C
Raw Normal View History

2018-09-27 00:30:05 +01:00
#ifndef BORDERMETATILESPIXMAPITEM_H
#define BORDERMETATILESPIXMAPITEM_H
#include "map.h"
#include "metatileselector.h"
#include <QGraphicsPixmapItem>
class BorderMetatilesPixmapItem : public QObject, public QGraphicsPixmapItem {
Q_OBJECT
public:
BorderMetatilesPixmapItem(Map *map_, MetatileSelector *metatileSelector) {
this->map = map_;
2020-07-29 20:51:04 +01:00
this->map->setBorderItem(this);
2018-09-27 00:30:05 +01:00
this->metatileSelector = metatileSelector;
setAcceptHoverEvents(true);
}
MetatileSelector *metatileSelector;
2020-07-29 20:51:04 +01:00
Map *map;
2018-09-27 00:30:05 +01:00
void draw();
signals:
void hoveredBorderMetatileSelectionChanged(uint16_t);
void hoveredBorderMetatileSelectionCleared();
2018-09-27 00:30:05 +01:00
void borderMetatilesChanged();
private:
void hoverUpdate(const QPointF &);
2018-09-27 00:30:05 +01:00
protected:
void mousePressEvent(QGraphicsSceneMouseEvent*);
void mouseMoveEvent(QGraphicsSceneMouseEvent*);
void hoverMoveEvent(QGraphicsSceneHoverEvent*);
void hoverLeaveEvent(QGraphicsSceneHoverEvent*);
2018-09-27 00:30:05 +01:00
};
#endif // BORDERMETATILESPIXMAPITEM_H