3 #include "../model/arenaelement.h" 4 #include "../model/arenaelementtype.h" 13 #include <QGraphicsSceneMouseEvent> 15 #include <QStyleOptionGraphicsItem> 22 setFlag(QGraphicsItem::ItemIsMovable,
true);
23 setFlag(QGraphicsItem::ItemIsSelectable,
true);
25 connect(element, SIGNAL(posChanged(
ArenaElement*, QPoint)),
27 connect(element, SIGNAL(rotationChanged(
ArenaElement*,
int)),
41 setTransformOriginPoint(pixmap().width() / 2.0, pixmap().width() / 2.0);
62 QPointF offset(-pixmap().width() / 2.0, -pixmap().height() / 2.0);
81 setRotation(rotation);
88 QMimeData *data =
new QMimeData;
91 QDrag *drag =
new QDrag(event->widget());
92 drag->setMimeData(data);
95 setCursor(Qt::OpenHandCursor);
101 QGraphicsPixmapItem::mousePressEvent(event);
Item freely movable within a grid point.
ArenaElementType const * type() const
void slotRotationChanged(ArenaElement *element, int rotation)
void mousePressEvent(QGraphicsSceneMouseEvent *event)
void setIsEditorSample(bool isEditorSample)
ArenaElement * element() const
ArenaSceneElement(ArenaElement *element)
QPointF itemOffset() const
Returns the item's offset from the grid point with 0 <= x,y <= 1 ( (0,0) is bottom left) ...
int rotation() const
Returns the rotation in degrees.
void slotPosChanged(ArenaElement *element, QPoint pos)
QPoint pos() const
Returns the position in arena coordinates.
static QPointF gridToScene(QPointF gridPos)
Item that can be mounted to a wall element.