18 #ifndef QNLYGRAPHICSREGION_H
19 #define QNLYGRAPHICSREGION_H
21 #include <QGraphicsItem>
24 #include <QPainterPath>
26 #include <QActionGroup>
29 #include <QGraphicsSceneContextMenuEvent>
32 #include <QGraphicsScene>
34 #include <QStyleOptionGraphicsItem>
36 #include <QTextDocument>
38 #include <QGraphicsSceneMouseEvent>
40 #include "qnlygraphicsregionbase.h"
44 #define ROUND_DOUBLE(x) x<0.0?x=0.0:(x>100.0?x=0.0:x)
49 Q_INTERFACES(QGraphicsItem)
67 bool isMoving()
const;
69 void setMoving(
bool moving);
71 bool isResizing()
const;
75 void setResizing(
bool resizing);
77 bool isSelected()
const;
79 void setSelected(
bool selected);
81 bool isPainted()
const;
83 void setPainted(
bool painted);
85 bool hasChanged()
const;
87 void setChanged(
bool changed);
89 bool isValidated()
const;
91 void setValidated(
bool validated);
93 QString getId()
const;
95 void setId(
const QString &
id);
97 QString getUid()
const;
99 void setUid(
const QString &uid);
101 QString getTitle()
const;
103 void setTitle(
const QString &title);
105 QString getColor()
const;
107 void setColor(
const QString &color);
109 int getzIndex()
const;
111 void setzIndex(
int zindex);
113 qreal getzIndexTop()
const;
115 qreal getTop()
const;
117 qreal getMoveTop()
const;
119 qreal getPressTop()
const;
121 qreal getResizeTop()
const;
123 qreal getRelativeTop()
const;
125 void setRelativeTop(qreal relativeTop);
127 qreal getLeft()
const;
129 qreal getMoveLeft()
const;
131 qreal getPressLeft()
const;
133 qreal getResizeLeft()
const;
135 qreal getRelativeLeft()
const;
137 void setRelativeLeft(qreal relativeLeft);
139 qreal getRight()
const;
141 qreal getRelativeRight()
const;
143 void setRelativeRight(qreal relativeRight);
145 qreal getBottom()
const;
147 qreal getRelativeBottom()
const;
149 void setRelativeBottom(qreal relativeBottom);
151 qreal getWidth()
const;
153 qreal getPressWidth()
const;
155 qreal getResizeWidth()
const;
157 qreal getRelativeWidth()
const;
159 void setRelativeWidth(qreal relativeWidth);
161 qreal getHeight()
const;
163 qreal getPressHeight()
const;
165 qreal getResizeHeight()
const;
167 qreal getRelativeHeight()
const;
169 void setRelativeHeight(qreal relativeHeight);
171 QnlyResizeType getResizeType()
const;
173 void adjust(
bool repaint =
true);
183 void updateCursor(QGraphicsSceneMouseEvent* event);
185 void setGridAction(QAction* action);
195 QMap<QString, QString> attributes);
199 void regionbasePerformed();
202 void setTop(qreal top);
204 void setMoveTop(qreal moveTop);
206 void setPressTop(qreal pressTop);
208 void setResizeTop(qreal resizeTop);
210 void setLeft(qreal left);
212 void setMoveLeft(qreal moveLeft);
214 void setPressLeft(qreal pressLeft);
216 void setResizeLeft(qreal resizeLeft);
218 void setRight(qreal right);
220 void setBottom(qreal bottom);
222 void setWidth(qreal width);
224 void setPressWidth(qreal pressWidth);
226 void setResizeWidth(qreal resizeWidth);
228 void setHeight(qreal height);
230 void setPressHeight(qreal pressHeight);
232 void setResizeHeight(qreal resizeHeight);
234 void setzIndexTop(qreal zindexTop);
236 void setResizeType(
const QnlyResizeType &resizeType);
238 virtual void move(QGraphicsSceneMouseEvent* event);
240 virtual void resize(QGraphicsSceneMouseEvent* event);
242 virtual QPainterPath shape()
const;
244 virtual QRectF boundingRect()
const;
246 virtual void paint(QPainter *painter,
const QStyleOptionGraphicsItem *option, QWidget *widget);
248 virtual void mouseMoveEvent(QGraphicsSceneMouseEvent* event);
250 virtual void mousePressEvent(QGraphicsSceneMouseEvent* event);
252 virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent* event);
254 virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent* event);
256 void keyReleaseEvent(QKeyEvent * event);
258 void keyPressEvent(QKeyEvent * event);
260 void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
262 void dropEvent(QGraphicsSceneDragDropEvent *event);
265 void performShow(QAction* action);
267 void performRegion();
271 void performDelete();
273 void performExport();
276 void createActions();
280 void createConnections();
320 qreal relativeBottom;
336 qreal relativeHeight;
364 QAction* pasteAction;
366 QAction* deleteAction;
368 QAction* zoominAction;
370 QAction* zoomoutAction;
372 QAction* zoomresetAction;
376 QAction* fullscreenAction;
378 QAction* exportAction;
380 QAction* regionAction;
382 QAction* regionbaseAction;
384 QAction* bringfrontAction;
386 QAction* bringforwardAction;
388 QAction* sendbackwardAction;
390 QAction* sendbackAction;
392 QAction* propertiesAction;
404 QnlyResizeType resizeType;
406 QActionGroup* regionActionGroup;
408 QMap<QString, QAction*> regionActions;
410 QMap<QString, QnlyGraphicsRegion*> regions;
413 #endif // QNLYGRAPHICSREGION_H