porymap/include/ui/collisionpixmapitem.h

51 lines
1.7 KiB
C
Raw Normal View History

2018-09-27 00:30:05 +01:00
#ifndef COLLISIONPIXMAPITEM_H
#define COLLISIONPIXMAPITEM_H
2023-12-07 18:45:08 +00:00
#include <QSpinBox>
2018-09-27 00:30:05 +01:00
#include "metatileselector.h"
#include "mappixmapitem.h"
#include "map.h"
#include "settings.h"
class CollisionPixmapItem : public MapPixmapItem {
Q_OBJECT
public:
2023-12-07 18:45:08 +00:00
CollisionPixmapItem(Map *map, QSpinBox * selectedCollision, QSpinBox * selectedElevation, MetatileSelector *metatileSelector, Settings *settings, qreal *opacity)
2018-09-27 00:30:05 +01:00
: MapPixmapItem(map, metatileSelector, settings){
2023-12-07 18:45:08 +00:00
this->selectedCollision = selectedCollision;
this->selectedElevation = selectedElevation;
this->opacity = opacity;
map->setCollisionItem(this);
2018-09-27 00:30:05 +01:00
}
2023-12-07 18:45:08 +00:00
QSpinBox * selectedCollision;
QSpinBox * selectedElevation;
qreal *opacity;
2018-09-27 00:30:05 +01:00
void updateMovementPermissionSelection(QGraphicsSceneMouseEvent *event);
virtual void paint(QGraphicsSceneMouseEvent*);
virtual void floodFill(QGraphicsSceneMouseEvent*);
virtual void magicFill(QGraphicsSceneMouseEvent*);
2018-09-27 00:30:05 +01:00
virtual void pick(QGraphicsSceneMouseEvent*);
void draw(bool ignoreCache = false);
2018-09-27 00:30:05 +01:00
private:
unsigned actionId_ = 0;
QPoint previousPos;
2023-12-07 18:45:08 +00:00
void updateSelection(QPoint pos);
2018-09-27 00:30:05 +01:00
signals:
void mouseEvent(QGraphicsSceneMouseEvent *, CollisionPixmapItem *);
void hoveredMapMovementPermissionChanged(int, int);
void hoveredMapMovementPermissionCleared();
protected:
void hoverMoveEvent(QGraphicsSceneHoverEvent*);
void hoverEnterEvent(QGraphicsSceneHoverEvent*);
2018-09-27 00:30:05 +01:00
void hoverLeaveEvent(QGraphicsSceneHoverEvent*);
void mousePressEvent(QGraphicsSceneMouseEvent*);
void mouseMoveEvent(QGraphicsSceneMouseEvent*);
void mouseReleaseEvent(QGraphicsSceneMouseEvent*);
};
#endif // COLLISIONPIXMAPITEM_H