arenascene.h
Go to the documentation of this file.
1 #ifndef ARENASCENE_H
2 #define ARENASCENE_H
3 
4 #include <QGraphicsScene>
5 #include <QGraphicsSceneDragDropEvent>
6 #include <QGraphicsSceneDragDropEvent>
7 #include <QMap>
8 
9 class Arena;
10 class ArenaElement;
11 class ArenaSceneElement;
12 
13 const int ITEM_SIZE = 80;
14 const int SPACING = 15;
15 const int CELL_SIZE = ITEM_SIZE + SPACING;
16 
17 class ArenaScene : public QGraphicsScene
18 {
19  Q_OBJECT
20 
21 public:
22  explicit ArenaScene(Arena* arena);
23 
24  static QPoint sceneToGrid(QPointF scenePos);
25  static QPointF sceneToGridF(QPointF scenePos);
26  static QPointF gridToScene(QPointF gridPos);
27 
28  static QPointF nearestGridPoint(QPointF scenePos);
29 
31 
32  QList<ArenaSceneElement*> selectedElements();
33 
34 private slots:
35  void slotElementAdded(ArenaElement *element);
36  void slotElementRemoved(ArenaElement *element);
37  void updateViewMargin();
38 
39 private:
40  void createGround();
41 
42  Arena * const m_arena;
43  QMap<ArenaElement*, ArenaSceneElement*> m_elements;
44 };
45 
46 #endif // ARENASCENE_H
QMap< ArenaElement *, ArenaSceneElement * > m_elements
Definition: arenascene.h:43
Arena *const m_arena
Definition: arenascene.h:42
QList< ArenaSceneElement * > selectedElements()
Definition: arenascene.cpp:61
void slotElementAdded(ArenaElement *element)
Definition: arenascene.cpp:99
ArenaScene(Arena *arena)
Definition: arenascene.cpp:17
const int ITEM_SIZE
Definition: arenascene.h:13
static QPoint sceneToGrid(QPointF scenePos)
Definition: arenascene.cpp:33
void slotElementRemoved(ArenaElement *element)
Definition: arenascene.cpp:109
const int SPACING
Definition: arenascene.h:14
void updateViewMargin()
Definition: arenascene.cpp:79
Definition: arena.h:10
const int CELL_SIZE
Definition: arenascene.h:15
static QPointF sceneToGridF(QPointF scenePos)
Definition: arenascene.cpp:39
static QPointF nearestGridPoint(QPointF scenePos)
Definition: arenascene.cpp:56
static QPointF gridToScene(QPointF gridPos)
Definition: arenascene.cpp:50
void createGround()
ArenaSceneElement * sceneElementFor(ArenaElement *element)
Definition: arenascene.cpp:74


hector_nist_arena_designer
Author(s): Stefan Kohlbrecher , Johannes Simon
autogenerated on Fri Aug 21 2020 10:45:27