4 #include "../model/arena.h" 5 #include "../model/arenaelement.h" 6 #include "../model/arenaelementtype.h" 9 #include <QGraphicsPixmapItem> 24 connect(arena, SIGNAL(modified()),
36 return QPoint(qRound(gridPos.x()), qRound(gridPos.y()));
42 qreal x = scenePos.x() +
SPACING;
44 qreal y = -(scenePos.y() +
SPACING);
63 QList<ArenaSceneElement*> list;
64 foreach(QGraphicsItem* item, selectedItems())
89 left = qMin(left, pos.x());
90 right = qMax(right, pos.x());
91 top = qMax(top, pos.y());
92 bottom = qMin(bottom, pos.y());
95 QPointF bottomRight =
gridToScene(QPoint(right, bottom));
96 setSceneRect(QRectF(topLeft, bottomRight));
104 addItem(sceneElement);
112 Q_ASSERT(sceneElement);
114 removeItem(sceneElement);
QMap< ArenaElement *, ArenaSceneElement * > m_elements
QList< ArenaSceneElement * > selectedElements()
void slotElementAdded(ArenaElement *element)
static QPoint sceneToGrid(QPointF scenePos)
void slotElementRemoved(ArenaElement *element)
ArenaElement * element() const
QPoint pos() const
Returns the position in arena coordinates.
static QPointF sceneToGridF(QPointF scenePos)
static QPointF nearestGridPoint(QPointF scenePos)
static QPointF gridToScene(QPointF gridPos)
QList< ArenaElement * > elements()
ArenaSceneElement * sceneElementFor(ArenaElement *element)