1 #ifndef QNCGGRAPHICSENTITY_H
2 #define QNCGGRAPHICSENTITY_H
4 #include <QGraphicsItem>
5 #include <QGraphicsScene>
7 #include <QPainterPath>
8 #include <QGraphicsSceneMouseEvent>
9 #include <QGraphicsSceneHoverEvent>
17 typedef Qncg::EntityType QncgEntityType;
18 typedef Qncg::ResizeType QncgResizeType;
29 void setMoveable(
bool moveable);
31 bool isMoveable()
const;
33 void setSelectable(
bool selected);
35 bool isSelectable()
const;
37 void setResizable(
bool resizable);
39 bool isResizable()
const;
41 void setMoving(
bool moving);
43 bool isMoving()
const;
45 void setResizing(
bool resizing);
47 bool isResizing()
const;
49 void setSelected(
bool selected);
51 bool isSelected()
const;
55 void setTop(qreal top);
57 qreal getMoveTop()
const;
59 void setMoveTop(qreal moveTop);
61 qreal getPressTop()
const;
63 void setPressTop(qreal pressTop);
65 qreal getResizeTop()
const;
67 void setResizeTop(qreal resizeTop);
69 qreal getLeft()
const;
71 void setLeft(qreal left);
73 qreal getMoveLeft()
const;
75 void setMoveLeft(qreal moveLeft);
77 qreal getPressLeft()
const;
79 void setPressLeft(qreal pressLeft);
81 qreal getResizeLeft()
const;
83 void setResizeLeft(qreal resizeLeft);
85 qreal getWidth()
const;
87 void setWidth(qreal width);
89 qreal getPressWidth()
const;
91 void setPressWidth(qreal pressWidth);
93 qreal getResizeWidth()
const;
95 void setResizeWidth(qreal resizeWidth);
97 qreal getHeight()
const;
99 void setHeight(qreal height);
101 qreal getPressHeight()
const;
103 void setPressHeight(qreal pressHeight);
105 qreal getResizeHeight()
const;
107 void setResizeHeight(qreal resizeHeight);
109 int getzIndex()
const;
111 void setzIndex(
int zindex);
113 QncgResizeType getncgResize()
const;
115 void setncgResize(QncgResizeType resizeType);
117 QncgEntityType getncgType()
const;
119 void setncgType(QncgEntityType entityType);
125 QVector<QncgGraphicsEntity*> getncgGraphicsEntities();
131 virtual void adjust(
bool avoidCollision =
false) = 0;
134 void entityAboutToChange(QMap<QString, QString> properties);
136 void entityChanged();
138 void entitySelected();
141 virtual void draw(QPainter* painter) = 0;
143 virtual void delineate(QPainterPath* painter)
const = 0;
145 virtual void move(QGraphicsSceneMouseEvent* event) = 0;
147 virtual void resize(QGraphicsSceneMouseEvent* event) = 0;
149 virtual QPainterPath shape()
const;
151 virtual QRectF boundingRect()
const;
153 virtual void paint(QPainter *painter,
const QStyleOptionGraphicsItem *option, QWidget *widget);
155 virtual void mouseMoveEvent(QGraphicsSceneMouseEvent* event);
157 virtual void mousePressEvent(QGraphicsSceneMouseEvent* event);
159 virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent*event);
161 virtual void hoverMoveEvent(QGraphicsSceneHoverEvent* event);
206 QncgEntityType entityType;
208 QncgResizeType resizeType;
212 QVector<QncgGraphicsEntity*> entities;
215 #endif // QNCGGRAPHICSENTITY_H