author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Mon, 04 Oct 2010 01:19:32 +0300 | |
changeset 37 | 758a864f9613 |
parent 33 | 3e2da88830cd |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the QtGui module of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#ifndef QGRAPHICSITEM_H |
|
43 |
#define QGRAPHICSITEM_H |
|
44 |
||
45 |
#include <QtCore/qglobal.h> |
|
46 |
#include <QtCore/qobject.h> |
|
47 |
#include <QtCore/qvariant.h> |
|
48 |
#include <QtCore/qrect.h> |
|
49 |
#include <QtCore/qscopedpointer.h> |
|
50 |
#include <QtGui/qpainterpath.h> |
|
51 |
#include <QtGui/qpixmap.h> |
|
52 |
||
53 |
class tst_QGraphicsItem; |
|
54 |
||
55 |
QT_BEGIN_HEADER |
|
56 |
||
57 |
QT_BEGIN_NAMESPACE |
|
58 |
||
59 |
QT_MODULE(Gui) |
|
60 |
||
61 |
#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW |
|
62 |
||
63 |
class QBrush; |
|
64 |
class QCursor; |
|
65 |
class QFocusEvent; |
|
66 |
class QGraphicsEffect; |
|
67 |
class QGraphicsItemGroup; |
|
68 |
class QGraphicsObject; |
|
69 |
class QGraphicsSceneContextMenuEvent; |
|
70 |
class QGraphicsSceneDragDropEvent; |
|
71 |
class QGraphicsSceneEvent; |
|
72 |
class QGraphicsSceneHoverEvent; |
|
73 |
class QGraphicsSceneMouseEvent; |
|
74 |
class QGraphicsSceneWheelEvent; |
|
75 |
class QGraphicsScene; |
|
76 |
class QGraphicsTransform; |
|
77 |
class QGraphicsWidget; |
|
78 |
class QInputMethodEvent; |
|
79 |
class QKeyEvent; |
|
80 |
class QMatrix; |
|
81 |
class QMenu; |
|
82 |
class QPainter; |
|
83 |
class QPen; |
|
84 |
class QPointF; |
|
85 |
class QRectF; |
|
86 |
class QStyleOptionGraphicsItem; |
|
87 |
||
88 |
class QGraphicsItemPrivate; |
|
89 |
class Q_GUI_EXPORT QGraphicsItem |
|
90 |
{ |
|
91 |
public: |
|
92 |
enum GraphicsItemFlag { |
|
93 |
ItemIsMovable = 0x1, |
|
94 |
ItemIsSelectable = 0x2, |
|
95 |
ItemIsFocusable = 0x4, |
|
96 |
ItemClipsToShape = 0x8, |
|
97 |
ItemClipsChildrenToShape = 0x10, |
|
98 |
ItemIgnoresTransformations = 0x20, |
|
99 |
ItemIgnoresParentOpacity = 0x40, |
|
100 |
ItemDoesntPropagateOpacityToChildren = 0x80, |
|
101 |
ItemStacksBehindParent = 0x100, |
|
102 |
ItemUsesExtendedStyleOption = 0x200, |
|
103 |
ItemHasNoContents = 0x400, |
|
104 |
ItemSendsGeometryChanges = 0x800, |
|
105 |
ItemAcceptsInputMethod = 0x1000, |
|
106 |
ItemNegativeZStacksBehindParent = 0x2000, |
|
107 |
ItemIsPanel = 0x4000, |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
108 |
ItemIsFocusScope = 0x8000, // internal |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
109 |
ItemSendsScenePositionChanges = 0x10000, |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
110 |
ItemStopsClickFocusPropagation = 0x20000 |
0 | 111 |
// NB! Don't forget to increase the d_ptr->flags bit field by 1 when adding a new flag. |
112 |
}; |
|
113 |
Q_DECLARE_FLAGS(GraphicsItemFlags, GraphicsItemFlag) |
|
114 |
||
115 |
enum GraphicsItemChange { |
|
116 |
ItemPositionChange, |
|
117 |
ItemMatrixChange, |
|
118 |
ItemVisibleChange, |
|
119 |
ItemEnabledChange, |
|
120 |
ItemSelectedChange, |
|
121 |
ItemParentChange, |
|
122 |
ItemChildAddedChange, |
|
123 |
ItemChildRemovedChange, |
|
124 |
ItemTransformChange, |
|
125 |
ItemPositionHasChanged, |
|
126 |
ItemTransformHasChanged, |
|
127 |
ItemSceneChange, |
|
128 |
ItemVisibleHasChanged, |
|
129 |
ItemEnabledHasChanged, |
|
130 |
ItemSelectedHasChanged, |
|
131 |
ItemParentHasChanged, |
|
132 |
ItemSceneHasChanged, |
|
133 |
ItemCursorChange, |
|
134 |
ItemCursorHasChanged, |
|
135 |
ItemToolTipChange, |
|
136 |
ItemToolTipHasChanged, |
|
137 |
ItemFlagsChange, |
|
138 |
ItemFlagsHaveChanged, |
|
139 |
ItemZValueChange, |
|
140 |
ItemZValueHasChanged, |
|
141 |
ItemOpacityChange, |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
142 |
ItemOpacityHasChanged, |
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
143 |
ItemScenePositionHasChanged, |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
144 |
ItemRotationChange, |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
145 |
ItemRotationHasChanged, |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
146 |
ItemScaleChange, |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
147 |
ItemScaleHasChanged, |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
148 |
ItemTransformOriginPointChange, |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
149 |
ItemTransformOriginPointHasChanged |
0 | 150 |
}; |
151 |
||
152 |
enum CacheMode { |
|
153 |
NoCache, |
|
154 |
ItemCoordinateCache, |
|
155 |
DeviceCoordinateCache |
|
156 |
}; |
|
157 |
||
158 |
enum PanelModality |
|
159 |
{ |
|
160 |
NonModal, |
|
161 |
PanelModal, |
|
162 |
SceneModal |
|
163 |
}; |
|
164 |
||
165 |
QGraphicsItem(QGraphicsItem *parent = 0 |
|
166 |
#ifndef Q_QDOC |
|
167 |
// ### obsolete argument |
|
168 |
, QGraphicsScene *scene = 0 |
|
169 |
#endif |
|
170 |
); |
|
171 |
virtual ~QGraphicsItem(); |
|
172 |
||
173 |
QGraphicsScene *scene() const; |
|
174 |
||
175 |
QGraphicsItem *parentItem() const; |
|
176 |
QGraphicsItem *topLevelItem() const; |
|
177 |
QGraphicsObject *parentObject() const; |
|
178 |
QGraphicsWidget *parentWidget() const; |
|
179 |
QGraphicsWidget *topLevelWidget() const; |
|
180 |
QGraphicsWidget *window() const; |
|
181 |
QGraphicsItem *panel() const; |
|
182 |
void setParentItem(QGraphicsItem *parent); |
|
183 |
QList<QGraphicsItem *> children() const; // ### obsolete |
|
184 |
QList<QGraphicsItem *> childItems() const; |
|
185 |
bool isWidget() const; |
|
186 |
bool isWindow() const; |
|
187 |
bool isPanel() const; |
|
188 |
||
189 |
QGraphicsObject *toGraphicsObject(); |
|
190 |
const QGraphicsObject *toGraphicsObject() const; |
|
191 |
||
192 |
QGraphicsItemGroup *group() const; |
|
193 |
void setGroup(QGraphicsItemGroup *group); |
|
194 |
||
195 |
GraphicsItemFlags flags() const; |
|
196 |
void setFlag(GraphicsItemFlag flag, bool enabled = true); |
|
197 |
void setFlags(GraphicsItemFlags flags); |
|
198 |
||
199 |
CacheMode cacheMode() const; |
|
200 |
void setCacheMode(CacheMode mode, const QSize &cacheSize = QSize()); |
|
201 |
||
202 |
PanelModality panelModality() const; |
|
203 |
void setPanelModality(PanelModality panelModality); |
|
204 |
bool isBlockedByModalPanel(QGraphicsItem **blockingPanel = 0) const; |
|
205 |
||
206 |
#ifndef QT_NO_TOOLTIP |
|
207 |
QString toolTip() const; |
|
208 |
void setToolTip(const QString &toolTip); |
|
209 |
#endif |
|
210 |
||
211 |
#ifndef QT_NO_CURSOR |
|
212 |
QCursor cursor() const; |
|
213 |
void setCursor(const QCursor &cursor); |
|
214 |
bool hasCursor() const; |
|
215 |
void unsetCursor(); |
|
216 |
#endif |
|
217 |
||
218 |
bool isVisible() const; |
|
219 |
bool isVisibleTo(const QGraphicsItem *parent) const; |
|
220 |
void setVisible(bool visible); |
|
221 |
inline void hide() { setVisible(false); } |
|
222 |
inline void show() { setVisible(true); } |
|
223 |
||
224 |
bool isEnabled() const; |
|
225 |
void setEnabled(bool enabled); |
|
226 |
||
227 |
bool isSelected() const; |
|
228 |
void setSelected(bool selected); |
|
229 |
||
230 |
bool acceptDrops() const; |
|
231 |
void setAcceptDrops(bool on); |
|
232 |
||
233 |
qreal opacity() const; |
|
234 |
qreal effectiveOpacity() const; |
|
235 |
void setOpacity(qreal opacity); |
|
236 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
237 |
#ifndef QT_NO_GRAPHICSEFFECT |
0 | 238 |
// Effect |
239 |
QGraphicsEffect *graphicsEffect() const; |
|
240 |
void setGraphicsEffect(QGraphicsEffect *effect); |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
241 |
#endif //QT_NO_GRAPHICSEFFECT |
0 | 242 |
|
243 |
Qt::MouseButtons acceptedMouseButtons() const; |
|
244 |
void setAcceptedMouseButtons(Qt::MouseButtons buttons); |
|
245 |
||
246 |
bool acceptsHoverEvents() const; // ### obsolete |
|
247 |
void setAcceptsHoverEvents(bool enabled); // ### obsolete |
|
248 |
bool acceptHoverEvents() const; |
|
249 |
void setAcceptHoverEvents(bool enabled); |
|
250 |
bool acceptTouchEvents() const; |
|
251 |
void setAcceptTouchEvents(bool enabled); |
|
252 |
||
253 |
bool filtersChildEvents() const; |
|
254 |
void setFiltersChildEvents(bool enabled); |
|
255 |
||
256 |
bool handlesChildEvents() const; |
|
257 |
void setHandlesChildEvents(bool enabled); |
|
258 |
||
259 |
bool isActive() const; |
|
260 |
void setActive(bool active); |
|
261 |
||
262 |
bool hasFocus() const; |
|
263 |
void setFocus(Qt::FocusReason focusReason = Qt::OtherFocusReason); |
|
264 |
void clearFocus(); |
|
265 |
||
266 |
QGraphicsItem *focusProxy() const; |
|
267 |
void setFocusProxy(QGraphicsItem *item); |
|
268 |
||
269 |
QGraphicsItem *focusItem() const; |
|
270 |
QGraphicsItem *focusScopeItem() const; |
|
271 |
||
272 |
void grabMouse(); |
|
273 |
void ungrabMouse(); |
|
274 |
void grabKeyboard(); |
|
275 |
void ungrabKeyboard(); |
|
276 |
||
277 |
// Positioning in scene coordinates |
|
278 |
QPointF pos() const; |
|
279 |
inline qreal x() const { return pos().x(); } |
|
280 |
void setX(qreal x); |
|
281 |
inline qreal y() const { return pos().y(); } |
|
282 |
void setY(qreal y); |
|
283 |
QPointF scenePos() const; |
|
284 |
void setPos(const QPointF &pos); |
|
285 |
inline void setPos(qreal x, qreal y); |
|
286 |
inline void moveBy(qreal dx, qreal dy) { setPos(pos().x() + dx, pos().y() + dy); } |
|
287 |
||
288 |
void ensureVisible(const QRectF &rect = QRectF(), int xmargin = 50, int ymargin = 50); |
|
289 |
inline void ensureVisible(qreal x, qreal y, qreal w, qreal h, int xmargin = 50, int ymargin = 50); |
|
290 |
||
291 |
// Local transformation |
|
292 |
QMatrix matrix() const; |
|
293 |
QMatrix sceneMatrix() const; |
|
294 |
void setMatrix(const QMatrix &matrix, bool combine = false); |
|
295 |
void resetMatrix(); |
|
296 |
QTransform transform() const; |
|
297 |
QTransform sceneTransform() const; |
|
298 |
QTransform deviceTransform(const QTransform &viewportTransform) const; |
|
299 |
QTransform itemTransform(const QGraphicsItem *other, bool *ok = 0) const; |
|
300 |
void setTransform(const QTransform &matrix, bool combine = false); |
|
301 |
void resetTransform(); |
|
302 |
||
303 |
void rotate(qreal angle); // ### obsolete |
|
304 |
void scale(qreal sx, qreal sy); // ### obsolete |
|
305 |
void shear(qreal sh, qreal sv); // ### obsolete |
|
306 |
void translate(qreal dx, qreal dy); // ### obsolete |
|
307 |
||
308 |
void setRotation(qreal angle); |
|
309 |
qreal rotation() const; |
|
310 |
||
311 |
void setScale(qreal scale); |
|
312 |
qreal scale() const; |
|
313 |
||
314 |
QList<QGraphicsTransform *> transformations() const; |
|
315 |
void setTransformations(const QList<QGraphicsTransform *> &transformations); |
|
316 |
||
317 |
QPointF transformOriginPoint() const; |
|
318 |
void setTransformOriginPoint(const QPointF &origin); |
|
319 |
inline void setTransformOriginPoint(qreal ax, qreal ay) |
|
320 |
{ setTransformOriginPoint(QPointF(ax,ay)); } |
|
321 |
||
322 |
virtual void advance(int phase); |
|
323 |
||
324 |
// Stacking order |
|
325 |
qreal zValue() const; |
|
326 |
void setZValue(qreal z); |
|
327 |
void stackBefore(const QGraphicsItem *sibling); |
|
328 |
||
329 |
// Hit test |
|
330 |
virtual QRectF boundingRect() const = 0; |
|
331 |
QRectF childrenBoundingRect() const; |
|
332 |
QRectF sceneBoundingRect() const; |
|
333 |
virtual QPainterPath shape() const; |
|
334 |
bool isClipped() const; |
|
335 |
QPainterPath clipPath() const; |
|
336 |
virtual bool contains(const QPointF &point) const; |
|
337 |
virtual bool collidesWithItem(const QGraphicsItem *other, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; |
|
338 |
virtual bool collidesWithPath(const QPainterPath &path, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; |
|
339 |
QList<QGraphicsItem *> collidingItems(Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const; |
|
340 |
bool isObscured() const; |
|
341 |
bool isObscured(const QRectF &rect) const; // ### Qt 5: merge with isObscured(), add QRectF arg to isObscuredBy() |
|
342 |
inline bool isObscured(qreal x, qreal y, qreal w, qreal h) const; |
|
343 |
virtual bool isObscuredBy(const QGraphicsItem *item) const; |
|
344 |
virtual QPainterPath opaqueArea() const; |
|
345 |
||
346 |
QRegion boundingRegion(const QTransform &itemToDeviceTransform) const; |
|
347 |
qreal boundingRegionGranularity() const; |
|
348 |
void setBoundingRegionGranularity(qreal granularity); |
|
349 |
||
350 |
// Drawing |
|
351 |
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) = 0; |
|
352 |
void update(const QRectF &rect = QRectF()); |
|
353 |
inline void update(qreal x, qreal y, qreal width, qreal height); |
|
354 |
void scroll(qreal dx, qreal dy, const QRectF &rect = QRectF()); |
|
355 |
||
356 |
// Coordinate mapping |
|
357 |
QPointF mapToItem(const QGraphicsItem *item, const QPointF &point) const; |
|
358 |
QPointF mapToParent(const QPointF &point) const; |
|
359 |
QPointF mapToScene(const QPointF &point) const; |
|
360 |
QPolygonF mapToItem(const QGraphicsItem *item, const QRectF &rect) const; |
|
361 |
QPolygonF mapToParent(const QRectF &rect) const; |
|
362 |
QPolygonF mapToScene(const QRectF &rect) const; |
|
363 |
QRectF mapRectToItem(const QGraphicsItem *item, const QRectF &rect) const; |
|
364 |
QRectF mapRectToParent(const QRectF &rect) const; |
|
365 |
QRectF mapRectToScene(const QRectF &rect) const; |
|
366 |
QPolygonF mapToItem(const QGraphicsItem *item, const QPolygonF &polygon) const; |
|
367 |
QPolygonF mapToParent(const QPolygonF &polygon) const; |
|
368 |
QPolygonF mapToScene(const QPolygonF &polygon) const; |
|
369 |
QPainterPath mapToItem(const QGraphicsItem *item, const QPainterPath &path) const; |
|
370 |
QPainterPath mapToParent(const QPainterPath &path) const; |
|
371 |
QPainterPath mapToScene(const QPainterPath &path) const; |
|
372 |
QPointF mapFromItem(const QGraphicsItem *item, const QPointF &point) const; |
|
373 |
QPointF mapFromParent(const QPointF &point) const; |
|
374 |
QPointF mapFromScene(const QPointF &point) const; |
|
375 |
QPolygonF mapFromItem(const QGraphicsItem *item, const QRectF &rect) const; |
|
376 |
QPolygonF mapFromParent(const QRectF &rect) const; |
|
377 |
QPolygonF mapFromScene(const QRectF &rect) const; |
|
378 |
QRectF mapRectFromItem(const QGraphicsItem *item, const QRectF &rect) const; |
|
379 |
QRectF mapRectFromParent(const QRectF &rect) const; |
|
380 |
QRectF mapRectFromScene(const QRectF &rect) const; |
|
381 |
QPolygonF mapFromItem(const QGraphicsItem *item, const QPolygonF &polygon) const; |
|
382 |
QPolygonF mapFromParent(const QPolygonF &polygon) const; |
|
383 |
QPolygonF mapFromScene(const QPolygonF &polygon) const; |
|
384 |
QPainterPath mapFromItem(const QGraphicsItem *item, const QPainterPath &path) const; |
|
385 |
QPainterPath mapFromParent(const QPainterPath &path) const; |
|
386 |
QPainterPath mapFromScene(const QPainterPath &path) const; |
|
387 |
||
388 |
inline QPointF mapToItem(const QGraphicsItem *item, qreal x, qreal y) const; |
|
389 |
inline QPointF mapToParent(qreal x, qreal y) const; |
|
390 |
inline QPointF mapToScene(qreal x, qreal y) const; |
|
391 |
inline QPolygonF mapToItem(const QGraphicsItem *item, qreal x, qreal y, qreal w, qreal h) const; |
|
392 |
inline QPolygonF mapToParent(qreal x, qreal y, qreal w, qreal h) const; |
|
393 |
inline QPolygonF mapToScene(qreal x, qreal y, qreal w, qreal h) const; |
|
394 |
inline QRectF mapRectToItem(const QGraphicsItem *item, qreal x, qreal y, qreal w, qreal h) const; |
|
395 |
inline QRectF mapRectToParent(qreal x, qreal y, qreal w, qreal h) const; |
|
396 |
inline QRectF mapRectToScene(qreal x, qreal y, qreal w, qreal h) const; |
|
397 |
inline QPointF mapFromItem(const QGraphicsItem *item, qreal x, qreal y) const; |
|
398 |
inline QPointF mapFromParent(qreal x, qreal y) const; |
|
399 |
inline QPointF mapFromScene(qreal x, qreal y) const; |
|
400 |
inline QPolygonF mapFromItem(const QGraphicsItem *item, qreal x, qreal y, qreal w, qreal h) const; |
|
401 |
inline QPolygonF mapFromParent(qreal x, qreal y, qreal w, qreal h) const; |
|
402 |
inline QPolygonF mapFromScene(qreal x, qreal y, qreal w, qreal h) const; |
|
403 |
inline QRectF mapRectFromItem(const QGraphicsItem *item, qreal x, qreal y, qreal w, qreal h) const; |
|
404 |
inline QRectF mapRectFromParent(qreal x, qreal y, qreal w, qreal h) const; |
|
405 |
inline QRectF mapRectFromScene(qreal x, qreal y, qreal w, qreal h) const; |
|
406 |
||
407 |
bool isAncestorOf(const QGraphicsItem *child) const; |
|
408 |
QGraphicsItem *commonAncestorItem(const QGraphicsItem *other) const; |
|
409 |
bool isUnderMouse() const; |
|
410 |
||
411 |
// Custom data |
|
412 |
QVariant data(int key) const; |
|
413 |
void setData(int key, const QVariant &value); |
|
414 |
||
415 |
Qt::InputMethodHints inputMethodHints() const; |
|
416 |
void setInputMethodHints(Qt::InputMethodHints hints); |
|
417 |
||
418 |
enum { |
|
419 |
Type = 1, |
|
420 |
UserType = 65536 |
|
421 |
}; |
|
422 |
virtual int type() const; |
|
423 |
||
424 |
void installSceneEventFilter(QGraphicsItem *filterItem); |
|
425 |
void removeSceneEventFilter(QGraphicsItem *filterItem); |
|
426 |
||
427 |
protected: |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
428 |
void updateMicroFocus(); |
0 | 429 |
virtual bool sceneEventFilter(QGraphicsItem *watched, QEvent *event); |
430 |
virtual bool sceneEvent(QEvent *event); |
|
431 |
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event); |
|
432 |
virtual void dragEnterEvent(QGraphicsSceneDragDropEvent *event); |
|
433 |
virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent *event); |
|
434 |
virtual void dragMoveEvent(QGraphicsSceneDragDropEvent *event); |
|
435 |
virtual void dropEvent(QGraphicsSceneDragDropEvent *event); |
|
436 |
virtual void focusInEvent(QFocusEvent *event); |
|
437 |
virtual void focusOutEvent(QFocusEvent *event); |
|
438 |
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event); |
|
439 |
virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event); |
|
440 |
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); |
|
441 |
virtual void keyPressEvent(QKeyEvent *event); |
|
442 |
virtual void keyReleaseEvent(QKeyEvent *event); |
|
443 |
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); |
|
444 |
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); |
|
445 |
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); |
|
446 |
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); |
|
447 |
virtual void wheelEvent(QGraphicsSceneWheelEvent *event); |
|
448 |
virtual void inputMethodEvent(QInputMethodEvent *event); |
|
449 |
virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const; |
|
450 |
||
451 |
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value); |
|
452 |
||
453 |
enum Extension { |
|
454 |
UserExtension = 0x80000000 |
|
455 |
}; |
|
456 |
virtual bool supportsExtension(Extension extension) const; |
|
457 |
virtual void setExtension(Extension extension, const QVariant &variant); |
|
458 |
virtual QVariant extension(const QVariant &variant) const; |
|
459 |
||
460 |
protected: |
|
461 |
QGraphicsItem(QGraphicsItemPrivate &dd, |
|
462 |
QGraphicsItem *parent, QGraphicsScene *scene); |
|
463 |
QScopedPointer<QGraphicsItemPrivate> d_ptr; |
|
464 |
||
465 |
void addToIndex(); |
|
466 |
void removeFromIndex(); |
|
467 |
void prepareGeometryChange(); |
|
468 |
||
469 |
private: |
|
470 |
Q_DISABLE_COPY(QGraphicsItem) |
|
471 |
Q_DECLARE_PRIVATE(QGraphicsItem) |
|
472 |
friend class QGraphicsItemGroup; |
|
473 |
friend class QGraphicsScene; |
|
474 |
friend class QGraphicsScenePrivate; |
|
475 |
friend class QGraphicsSceneFindItemBspTreeVisitor; |
|
476 |
friend class QGraphicsSceneBspTree; |
|
477 |
friend class QGraphicsView; |
|
478 |
friend class QGraphicsViewPrivate; |
|
479 |
friend class QGraphicsObject; |
|
480 |
friend class QGraphicsWidget; |
|
481 |
friend class QGraphicsWidgetPrivate; |
|
482 |
friend class QGraphicsProxyWidgetPrivate; |
|
483 |
friend class QGraphicsSceneIndex; |
|
484 |
friend class QGraphicsSceneIndexPrivate; |
|
485 |
friend class QGraphicsSceneBspTreeIndex; |
|
486 |
friend class QGraphicsSceneBspTreeIndexPrivate; |
|
487 |
friend class QGraphicsItemEffectSourcePrivate; |
|
488 |
friend class QGraphicsTransformPrivate; |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
489 |
#ifndef QT_NO_GESTURES |
0 | 490 |
friend class QGestureManager; |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
491 |
#endif |
0 | 492 |
friend class ::tst_QGraphicsItem; |
493 |
friend bool qt_closestLeaf(const QGraphicsItem *, const QGraphicsItem *); |
|
494 |
friend bool qt_closestItemFirst(const QGraphicsItem *, const QGraphicsItem *); |
|
495 |
}; |
|
496 |
||
497 |
Q_DECLARE_OPERATORS_FOR_FLAGS(QGraphicsItem::GraphicsItemFlags) |
|
498 |
Q_DECLARE_INTERFACE(QGraphicsItem, "com.trolltech.Qt.QGraphicsItem") |
|
499 |
||
500 |
inline void QGraphicsItem::setPos(qreal ax, qreal ay) |
|
501 |
{ setPos(QPointF(ax, ay)); } |
|
502 |
inline void QGraphicsItem::ensureVisible(qreal ax, qreal ay, qreal w, qreal h, int xmargin, int ymargin) |
|
503 |
{ ensureVisible(QRectF(ax, ay, w, h), xmargin, ymargin); } |
|
504 |
inline void QGraphicsItem::update(qreal ax, qreal ay, qreal width, qreal height) |
|
505 |
{ update(QRectF(ax, ay, width, height)); } |
|
506 |
inline bool QGraphicsItem::isObscured(qreal ax, qreal ay, qreal w, qreal h) const |
|
507 |
{ return isObscured(QRectF(ax, ay, w, h)); } |
|
508 |
inline QPointF QGraphicsItem::mapToItem(const QGraphicsItem *item, qreal ax, qreal ay) const |
|
509 |
{ return mapToItem(item, QPointF(ax, ay)); } |
|
510 |
inline QPointF QGraphicsItem::mapToParent(qreal ax, qreal ay) const |
|
511 |
{ return mapToParent(QPointF(ax, ay)); } |
|
512 |
inline QPointF QGraphicsItem::mapToScene(qreal ax, qreal ay) const |
|
513 |
{ return mapToScene(QPointF(ax, ay)); } |
|
514 |
inline QPointF QGraphicsItem::mapFromItem(const QGraphicsItem *item, qreal ax, qreal ay) const |
|
515 |
{ return mapFromItem(item, QPointF(ax, ay)); } |
|
516 |
inline QPointF QGraphicsItem::mapFromParent(qreal ax, qreal ay) const |
|
517 |
{ return mapFromParent(QPointF(ax, ay)); } |
|
518 |
inline QPointF QGraphicsItem::mapFromScene(qreal ax, qreal ay) const |
|
519 |
{ return mapFromScene(QPointF(ax, ay)); } |
|
520 |
inline QPolygonF QGraphicsItem::mapToItem(const QGraphicsItem *item, qreal ax, qreal ay, qreal w, qreal h) const |
|
521 |
{ return mapToItem(item, QRectF(ax, ay, w, h)); } |
|
522 |
inline QPolygonF QGraphicsItem::mapToParent(qreal ax, qreal ay, qreal w, qreal h) const |
|
523 |
{ return mapToParent(QRectF(ax, ay, w, h)); } |
|
524 |
inline QPolygonF QGraphicsItem::mapToScene(qreal ax, qreal ay, qreal w, qreal h) const |
|
525 |
{ return mapToScene(QRectF(ax, ay, w, h)); } |
|
526 |
inline QRectF QGraphicsItem::mapRectToItem(const QGraphicsItem *item, qreal ax, qreal ay, qreal w, qreal h) const |
|
527 |
{ return mapRectToItem(item, QRectF(ax, ay, w, h)); } |
|
528 |
inline QRectF QGraphicsItem::mapRectToParent(qreal ax, qreal ay, qreal w, qreal h) const |
|
529 |
{ return mapRectToParent(QRectF(ax, ay, w, h)); } |
|
530 |
inline QRectF QGraphicsItem::mapRectToScene(qreal ax, qreal ay, qreal w, qreal h) const |
|
531 |
{ return mapRectToScene(QRectF(ax, ay, w, h)); } |
|
532 |
inline QPolygonF QGraphicsItem::mapFromItem(const QGraphicsItem *item, qreal ax, qreal ay, qreal w, qreal h) const |
|
533 |
{ return mapFromItem(item, QRectF(ax, ay, w, h)); } |
|
534 |
inline QPolygonF QGraphicsItem::mapFromParent(qreal ax, qreal ay, qreal w, qreal h) const |
|
535 |
{ return mapFromParent(QRectF(ax, ay, w, h)); } |
|
536 |
inline QPolygonF QGraphicsItem::mapFromScene(qreal ax, qreal ay, qreal w, qreal h) const |
|
537 |
{ return mapFromScene(QRectF(ax, ay, w, h)); } |
|
538 |
inline QRectF QGraphicsItem::mapRectFromItem(const QGraphicsItem *item, qreal ax, qreal ay, qreal w, qreal h) const |
|
539 |
{ return mapRectFromItem(item, QRectF(ax, ay, w, h)); } |
|
540 |
inline QRectF QGraphicsItem::mapRectFromParent(qreal ax, qreal ay, qreal w, qreal h) const |
|
541 |
{ return mapRectFromParent(QRectF(ax, ay, w, h)); } |
|
542 |
inline QRectF QGraphicsItem::mapRectFromScene(qreal ax, qreal ay, qreal w, qreal h) const |
|
543 |
{ return mapRectFromScene(QRectF(ax, ay, w, h)); } |
|
544 |
||
545 |
||
546 |
class Q_GUI_EXPORT QGraphicsObject : public QObject, public QGraphicsItem |
|
547 |
{ |
|
548 |
Q_OBJECT |
|
549 |
Q_PROPERTY(QGraphicsObject * parent READ parentObject WRITE setParentItem NOTIFY parentChanged DESIGNABLE false) |
|
550 |
Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged FINAL) |
|
551 |
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged) |
|
552 |
Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged FINAL) |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
553 |
Q_PROPERTY(QPointF pos READ pos WRITE setPos FINAL) |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
554 |
Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged FINAL) |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
555 |
Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged FINAL) |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
556 |
Q_PROPERTY(qreal z READ zValue WRITE setZValue NOTIFY zChanged FINAL) |
0 | 557 |
Q_PROPERTY(qreal rotation READ rotation WRITE setRotation NOTIFY rotationChanged) |
558 |
Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged) |
|
559 |
Q_PROPERTY(QPointF transformOriginPoint READ transformOriginPoint WRITE setTransformOriginPoint) |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
560 |
#ifndef QT_NO_GRAPHICSEFFECT |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
561 |
Q_PROPERTY(QGraphicsEffect *effect READ graphicsEffect WRITE setGraphicsEffect) |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
562 |
#endif |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
563 |
Q_PRIVATE_PROPERTY(QGraphicsItem::d_func(), QDeclarativeListProperty<QGraphicsObject> children READ childrenList DESIGNABLE false NOTIFY childrenChanged) |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
564 |
Q_PRIVATE_PROPERTY(QGraphicsItem::d_func(), qreal width READ width WRITE setWidth NOTIFY widthChanged RESET resetWidth FINAL) |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
565 |
Q_PRIVATE_PROPERTY(QGraphicsItem::d_func(), qreal height READ height WRITE setHeight NOTIFY heightChanged RESET resetHeight FINAL) |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
566 |
Q_CLASSINFO("DefaultProperty", "children") |
0 | 567 |
Q_INTERFACES(QGraphicsItem) |
568 |
public: |
|
569 |
QGraphicsObject(QGraphicsItem *parent = 0); |
|
570 |
||
571 |
// ### Qt 5: Disambiguate |
|
572 |
#ifdef Q_NO_USING_KEYWORD |
|
573 |
const QObjectList &children() const { return QObject::children(); } |
|
574 |
#else |
|
575 |
using QObject::children; |
|
576 |
#endif |
|
577 |
||
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
578 |
#ifndef QT_NO_GESTURES |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
579 |
void grabGesture(Qt::GestureType type, Qt::GestureFlags flags = Qt::GestureFlags()); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
580 |
void ungrabGesture(Qt::GestureType type); |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
581 |
#endif |
0 | 582 |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
583 |
protected Q_SLOTS: |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
584 |
void updateMicroFocus(); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
585 |
|
0 | 586 |
Q_SIGNALS: |
587 |
void parentChanged(); |
|
588 |
void opacityChanged(); |
|
589 |
void visibleChanged(); |
|
590 |
void enabledChanged(); |
|
591 |
void xChanged(); |
|
592 |
void yChanged(); |
|
593 |
void zChanged(); |
|
594 |
void rotationChanged(); |
|
595 |
void scaleChanged(); |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
596 |
void childrenChanged(); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
597 |
void widthChanged(); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
598 |
void heightChanged(); |
0 | 599 |
|
600 |
protected: |
|
601 |
QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent, QGraphicsScene *scene); |
|
602 |
private: |
|
603 |
friend class QGraphicsItem; |
|
604 |
friend class QGraphicsItemPrivate; |
|
605 |
}; |
|
606 |
||
607 |
||
608 |
class QAbstractGraphicsShapeItemPrivate; |
|
609 |
class Q_GUI_EXPORT QAbstractGraphicsShapeItem : public QGraphicsItem |
|
610 |
{ |
|
611 |
public: |
|
612 |
QAbstractGraphicsShapeItem(QGraphicsItem *parent = 0 |
|
613 |
#ifndef Q_QDOC |
|
614 |
// ### obsolete argument |
|
615 |
, QGraphicsScene *scene = 0 |
|
616 |
#endif |
|
617 |
); |
|
618 |
~QAbstractGraphicsShapeItem(); |
|
619 |
||
620 |
QPen pen() const; |
|
621 |
void setPen(const QPen &pen); |
|
622 |
||
623 |
QBrush brush() const; |
|
624 |
void setBrush(const QBrush &brush); |
|
625 |
||
626 |
bool isObscuredBy(const QGraphicsItem *item) const; |
|
627 |
QPainterPath opaqueArea() const; |
|
628 |
||
629 |
protected: |
|
630 |
QAbstractGraphicsShapeItem(QAbstractGraphicsShapeItemPrivate &dd, |
|
631 |
QGraphicsItem *parent, QGraphicsScene *scene); |
|
632 |
||
633 |
private: |
|
634 |
Q_DISABLE_COPY(QAbstractGraphicsShapeItem) |
|
635 |
Q_DECLARE_PRIVATE(QAbstractGraphicsShapeItem) |
|
636 |
}; |
|
637 |
||
638 |
class QGraphicsPathItemPrivate; |
|
639 |
class Q_GUI_EXPORT QGraphicsPathItem : public QAbstractGraphicsShapeItem |
|
640 |
{ |
|
641 |
public: |
|
642 |
QGraphicsPathItem(QGraphicsItem *parent = 0 |
|
643 |
#ifndef Q_QDOC |
|
644 |
// ### obsolete argument |
|
645 |
, QGraphicsScene *scene = 0 |
|
646 |
#endif |
|
647 |
); |
|
648 |
QGraphicsPathItem(const QPainterPath &path, QGraphicsItem *parent = 0 |
|
649 |
#ifndef Q_QDOC |
|
650 |
// ### obsolete argument |
|
651 |
, QGraphicsScene *scene = 0 |
|
652 |
#endif |
|
653 |
); |
|
654 |
~QGraphicsPathItem(); |
|
655 |
||
656 |
QPainterPath path() const; |
|
657 |
void setPath(const QPainterPath &path); |
|
658 |
||
659 |
QRectF boundingRect() const; |
|
660 |
QPainterPath shape() const; |
|
661 |
bool contains(const QPointF &point) const; |
|
662 |
||
663 |
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); |
|
664 |
||
665 |
bool isObscuredBy(const QGraphicsItem *item) const; |
|
666 |
QPainterPath opaqueArea() const; |
|
667 |
||
668 |
enum { Type = 2 }; |
|
669 |
int type() const; |
|
670 |
||
671 |
protected: |
|
672 |
bool supportsExtension(Extension extension) const; |
|
673 |
void setExtension(Extension extension, const QVariant &variant); |
|
674 |
QVariant extension(const QVariant &variant) const; |
|
675 |
||
676 |
private: |
|
677 |
Q_DISABLE_COPY(QGraphicsPathItem) |
|
678 |
Q_DECLARE_PRIVATE(QGraphicsPathItem) |
|
679 |
}; |
|
680 |
||
681 |
class QGraphicsRectItemPrivate; |
|
682 |
class Q_GUI_EXPORT QGraphicsRectItem : public QAbstractGraphicsShapeItem |
|
683 |
{ |
|
684 |
public: |
|
685 |
QGraphicsRectItem(QGraphicsItem *parent = 0 |
|
686 |
#ifndef Q_QDOC |
|
687 |
// ### obsolete argument |
|
688 |
, QGraphicsScene *scene = 0 |
|
689 |
#endif |
|
690 |
); |
|
691 |
QGraphicsRectItem(const QRectF &rect, QGraphicsItem *parent = 0 |
|
692 |
#ifndef Q_QDOC |
|
693 |
// ### obsolete argument |
|
694 |
, QGraphicsScene *scene = 0 |
|
695 |
#endif |
|
696 |
); |
|
697 |
QGraphicsRectItem(qreal x, qreal y, qreal w, qreal h, QGraphicsItem *parent = 0 |
|
698 |
#ifndef Q_QDOC |
|
699 |
// ### obsolete argument |
|
700 |
, QGraphicsScene *scene = 0 |
|
701 |
#endif |
|
702 |
); |
|
703 |
~QGraphicsRectItem(); |
|
704 |
||
705 |
QRectF rect() const; |
|
706 |
void setRect(const QRectF &rect); |
|
707 |
inline void setRect(qreal x, qreal y, qreal w, qreal h); |
|
708 |
||
709 |
QRectF boundingRect() const; |
|
710 |
QPainterPath shape() const; |
|
711 |
bool contains(const QPointF &point) const; |
|
712 |
||
713 |
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); |
|
714 |
||
715 |
bool isObscuredBy(const QGraphicsItem *item) const; |
|
716 |
QPainterPath opaqueArea() const; |
|
717 |
||
718 |
enum { Type = 3 }; |
|
719 |
int type() const; |
|
720 |
||
721 |
protected: |
|
722 |
bool supportsExtension(Extension extension) const; |
|
723 |
void setExtension(Extension extension, const QVariant &variant); |
|
724 |
QVariant extension(const QVariant &variant) const; |
|
725 |
||
726 |
private: |
|
727 |
Q_DISABLE_COPY(QGraphicsRectItem) |
|
728 |
Q_DECLARE_PRIVATE(QGraphicsRectItem) |
|
729 |
}; |
|
730 |
||
731 |
inline void QGraphicsRectItem::setRect(qreal ax, qreal ay, qreal w, qreal h) |
|
732 |
{ setRect(QRectF(ax, ay, w, h)); } |
|
733 |
||
734 |
class QGraphicsEllipseItemPrivate; |
|
735 |
class Q_GUI_EXPORT QGraphicsEllipseItem : public QAbstractGraphicsShapeItem |
|
736 |
{ |
|
737 |
public: |
|
738 |
QGraphicsEllipseItem(QGraphicsItem *parent = 0 |
|
739 |
#ifndef Q_QDOC |
|
740 |
// ### obsolete argument |
|
741 |
, QGraphicsScene *scene = 0 |
|
742 |
#endif |
|
743 |
); |
|
744 |
QGraphicsEllipseItem(const QRectF &rect, QGraphicsItem *parent = 0 |
|
745 |
#ifndef Q_QDOC |
|
746 |
// ### obsolete argument |
|
747 |
, QGraphicsScene *scene = 0 |
|
748 |
#endif |
|
749 |
); |
|
750 |
QGraphicsEllipseItem(qreal x, qreal y, qreal w, qreal h, QGraphicsItem *parent = 0 |
|
751 |
#ifndef Q_QDOC |
|
752 |
// ### obsolete argument |
|
753 |
, QGraphicsScene *scene = 0 |
|
754 |
#endif |
|
755 |
); |
|
756 |
~QGraphicsEllipseItem(); |
|
757 |
||
758 |
QRectF rect() const; |
|
759 |
void setRect(const QRectF &rect); |
|
760 |
inline void setRect(qreal x, qreal y, qreal w, qreal h); |
|
761 |
||
762 |
int startAngle() const; |
|
763 |
void setStartAngle(int angle); |
|
764 |
||
765 |
int spanAngle() const; |
|
766 |
void setSpanAngle(int angle); |
|
767 |
||
768 |
QRectF boundingRect() const; |
|
769 |
QPainterPath shape() const; |
|
770 |
bool contains(const QPointF &point) const; |
|
771 |
||
772 |
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); |
|
773 |
||
774 |
bool isObscuredBy(const QGraphicsItem *item) const; |
|
775 |
QPainterPath opaqueArea() const; |
|
776 |
||
777 |
enum { Type = 4 }; |
|
778 |
int type() const; |
|
779 |
||
780 |
protected: |
|
781 |
bool supportsExtension(Extension extension) const; |
|
782 |
void setExtension(Extension extension, const QVariant &variant); |
|
783 |
QVariant extension(const QVariant &variant) const; |
|
784 |
||
785 |
private: |
|
786 |
Q_DISABLE_COPY(QGraphicsEllipseItem) |
|
787 |
Q_DECLARE_PRIVATE(QGraphicsEllipseItem) |
|
788 |
}; |
|
789 |
||
790 |
inline void QGraphicsEllipseItem::setRect(qreal ax, qreal ay, qreal w, qreal h) |
|
791 |
{ setRect(QRectF(ax, ay, w, h)); } |
|
792 |
||
793 |
class QGraphicsPolygonItemPrivate; |
|
794 |
class Q_GUI_EXPORT QGraphicsPolygonItem : public QAbstractGraphicsShapeItem |
|
795 |
{ |
|
796 |
public: |
|
797 |
QGraphicsPolygonItem(QGraphicsItem *parent = 0 |
|
798 |
#ifndef Q_QDOC |
|
799 |
// ### obsolete argument |
|
800 |
, QGraphicsScene *scene = 0 |
|
801 |
#endif |
|
802 |
); |
|
803 |
QGraphicsPolygonItem(const QPolygonF &polygon, |
|
804 |
QGraphicsItem *parent = 0 |
|
805 |
#ifndef Q_QDOC |
|
806 |
// ### obsolete argument |
|
807 |
, QGraphicsScene *scene = 0 |
|
808 |
#endif |
|
809 |
); |
|
810 |
~QGraphicsPolygonItem(); |
|
811 |
||
812 |
QPolygonF polygon() const; |
|
813 |
void setPolygon(const QPolygonF &polygon); |
|
814 |
||
815 |
Qt::FillRule fillRule() const; |
|
816 |
void setFillRule(Qt::FillRule rule); |
|
817 |
||
818 |
QRectF boundingRect() const; |
|
819 |
QPainterPath shape() const; |
|
820 |
bool contains(const QPointF &point) const; |
|
821 |
||
822 |
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); |
|
823 |
||
824 |
bool isObscuredBy(const QGraphicsItem *item) const; |
|
825 |
QPainterPath opaqueArea() const; |
|
826 |
||
827 |
enum { Type = 5 }; |
|
828 |
int type() const; |
|
829 |
||
830 |
protected: |
|
831 |
bool supportsExtension(Extension extension) const; |
|
832 |
void setExtension(Extension extension, const QVariant &variant); |
|
833 |
QVariant extension(const QVariant &variant) const; |
|
834 |
||
835 |
private: |
|
836 |
Q_DISABLE_COPY(QGraphicsPolygonItem) |
|
837 |
Q_DECLARE_PRIVATE(QGraphicsPolygonItem) |
|
838 |
}; |
|
839 |
||
840 |
class QGraphicsLineItemPrivate; |
|
841 |
class Q_GUI_EXPORT QGraphicsLineItem : public QGraphicsItem |
|
842 |
{ |
|
843 |
public: |
|
844 |
QGraphicsLineItem(QGraphicsItem *parent = 0 |
|
845 |
#ifndef Q_QDOC |
|
846 |
// ### obsolete argument |
|
847 |
, QGraphicsScene *scene = 0 |
|
848 |
#endif |
|
849 |
); |
|
850 |
QGraphicsLineItem(const QLineF &line, QGraphicsItem *parent = 0 |
|
851 |
#ifndef Q_QDOC |
|
852 |
// ### obsolete argument |
|
853 |
, QGraphicsScene *scene = 0 |
|
854 |
#endif |
|
855 |
); |
|
856 |
QGraphicsLineItem(qreal x1, qreal y1, qreal x2, qreal y2, QGraphicsItem *parent = 0 |
|
857 |
#ifndef Q_QDOC |
|
858 |
// ### obsolete argument |
|
859 |
, QGraphicsScene *scene = 0 |
|
860 |
#endif |
|
861 |
); |
|
862 |
~QGraphicsLineItem(); |
|
863 |
||
864 |
QPen pen() const; |
|
865 |
void setPen(const QPen &pen); |
|
866 |
||
867 |
QLineF line() const; |
|
868 |
void setLine(const QLineF &line); |
|
869 |
inline void setLine(qreal x1, qreal y1, qreal x2, qreal y2) |
|
870 |
{ setLine(QLineF(x1, y1, x2, y2)); } |
|
871 |
||
872 |
QRectF boundingRect() const; |
|
873 |
QPainterPath shape() const; |
|
874 |
bool contains(const QPointF &point) const; |
|
875 |
||
876 |
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); |
|
877 |
||
878 |
bool isObscuredBy(const QGraphicsItem *item) const; |
|
879 |
QPainterPath opaqueArea() const; |
|
880 |
||
881 |
enum { Type = 6 }; |
|
882 |
int type() const; |
|
883 |
||
884 |
protected: |
|
885 |
bool supportsExtension(Extension extension) const; |
|
886 |
void setExtension(Extension extension, const QVariant &variant); |
|
887 |
QVariant extension(const QVariant &variant) const; |
|
888 |
||
889 |
private: |
|
890 |
Q_DISABLE_COPY(QGraphicsLineItem) |
|
891 |
Q_DECLARE_PRIVATE(QGraphicsLineItem) |
|
892 |
}; |
|
893 |
||
894 |
class QGraphicsPixmapItemPrivate; |
|
895 |
class Q_GUI_EXPORT QGraphicsPixmapItem : public QGraphicsItem |
|
896 |
{ |
|
897 |
public: |
|
898 |
enum ShapeMode { |
|
899 |
MaskShape, |
|
900 |
BoundingRectShape, |
|
901 |
HeuristicMaskShape |
|
902 |
}; |
|
903 |
||
904 |
QGraphicsPixmapItem(QGraphicsItem *parent = 0 |
|
905 |
#ifndef Q_QDOC |
|
906 |
// ### obsolete argument |
|
907 |
, QGraphicsScene *scene = 0 |
|
908 |
#endif |
|
909 |
); |
|
910 |
QGraphicsPixmapItem(const QPixmap &pixmap, QGraphicsItem *parent = 0 |
|
911 |
#ifndef Q_QDOC |
|
912 |
// ### obsolete argument |
|
913 |
, QGraphicsScene *scene = 0 |
|
914 |
#endif |
|
915 |
); |
|
916 |
~QGraphicsPixmapItem(); |
|
917 |
||
918 |
QPixmap pixmap() const; |
|
919 |
void setPixmap(const QPixmap &pixmap); |
|
920 |
||
921 |
Qt::TransformationMode transformationMode() const; |
|
922 |
void setTransformationMode(Qt::TransformationMode mode); |
|
923 |
||
924 |
QPointF offset() const; |
|
925 |
void setOffset(const QPointF &offset); |
|
926 |
inline void setOffset(qreal x, qreal y); |
|
927 |
||
928 |
QRectF boundingRect() const; |
|
929 |
QPainterPath shape() const; |
|
930 |
bool contains(const QPointF &point) const; |
|
931 |
||
932 |
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); |
|
933 |
||
934 |
bool isObscuredBy(const QGraphicsItem *item) const; |
|
935 |
QPainterPath opaqueArea() const; |
|
936 |
||
937 |
enum { Type = 7 }; |
|
938 |
int type() const; |
|
939 |
||
940 |
ShapeMode shapeMode() const; |
|
941 |
void setShapeMode(ShapeMode mode); |
|
942 |
||
943 |
protected: |
|
944 |
bool supportsExtension(Extension extension) const; |
|
945 |
void setExtension(Extension extension, const QVariant &variant); |
|
946 |
QVariant extension(const QVariant &variant) const; |
|
947 |
||
948 |
private: |
|
949 |
Q_DISABLE_COPY(QGraphicsPixmapItem) |
|
950 |
Q_DECLARE_PRIVATE(QGraphicsPixmapItem) |
|
951 |
}; |
|
952 |
||
953 |
inline void QGraphicsPixmapItem::setOffset(qreal ax, qreal ay) |
|
954 |
{ setOffset(QPointF(ax, ay)); } |
|
955 |
||
956 |
class QGraphicsTextItemPrivate; |
|
957 |
class QTextDocument; |
|
958 |
class QTextCursor; |
|
959 |
class Q_GUI_EXPORT QGraphicsTextItem : public QGraphicsObject |
|
960 |
{ |
|
961 |
Q_OBJECT |
|
962 |
QDOC_PROPERTY(bool openExternalLinks READ openExternalLinks WRITE setOpenExternalLinks) |
|
963 |
QDOC_PROPERTY(QTextCursor textCursor READ textCursor WRITE setTextCursor) |
|
964 |
||
965 |
public: |
|
966 |
QGraphicsTextItem(QGraphicsItem *parent = 0 |
|
967 |
#ifndef Q_QDOC |
|
968 |
// ### obsolete argument |
|
969 |
, QGraphicsScene *scene = 0 |
|
970 |
#endif |
|
971 |
); |
|
972 |
QGraphicsTextItem(const QString &text, QGraphicsItem *parent = 0 |
|
973 |
#ifndef Q_QDOC |
|
974 |
// ### obsolete argument |
|
975 |
, QGraphicsScene *scene = 0 |
|
976 |
#endif |
|
977 |
); |
|
978 |
~QGraphicsTextItem(); |
|
979 |
||
980 |
QString toHtml() const; |
|
981 |
void setHtml(const QString &html); |
|
982 |
||
983 |
QString toPlainText() const; |
|
984 |
void setPlainText(const QString &text); |
|
985 |
||
986 |
QFont font() const; |
|
987 |
void setFont(const QFont &font); |
|
988 |
||
989 |
void setDefaultTextColor(const QColor &c); |
|
990 |
QColor defaultTextColor() const; |
|
991 |
||
992 |
QRectF boundingRect() const; |
|
993 |
QPainterPath shape() const; |
|
994 |
bool contains(const QPointF &point) const; |
|
995 |
||
996 |
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); |
|
997 |
||
998 |
bool isObscuredBy(const QGraphicsItem *item) const; |
|
999 |
QPainterPath opaqueArea() const; |
|
1000 |
||
1001 |
enum { Type = 8 }; |
|
1002 |
int type() const; |
|
1003 |
||
1004 |
void setTextWidth(qreal width); |
|
1005 |
qreal textWidth() const; |
|
1006 |
||
1007 |
void adjustSize(); |
|
1008 |
||
1009 |
void setDocument(QTextDocument *document); |
|
1010 |
QTextDocument *document() const; |
|
1011 |
||
1012 |
void setTextInteractionFlags(Qt::TextInteractionFlags flags); |
|
1013 |
Qt::TextInteractionFlags textInteractionFlags() const; |
|
1014 |
||
1015 |
void setTabChangesFocus(bool b); |
|
1016 |
bool tabChangesFocus() const; |
|
1017 |
||
1018 |
void setOpenExternalLinks(bool open); |
|
1019 |
bool openExternalLinks() const; |
|
1020 |
||
1021 |
void setTextCursor(const QTextCursor &cursor); |
|
1022 |
QTextCursor textCursor() const; |
|
1023 |
||
1024 |
Q_SIGNALS: |
|
1025 |
void linkActivated(const QString &); |
|
1026 |
void linkHovered(const QString &); |
|
1027 |
||
1028 |
protected: |
|
1029 |
bool sceneEvent(QEvent *event); |
|
1030 |
void mousePressEvent(QGraphicsSceneMouseEvent *event); |
|
1031 |
void mouseMoveEvent(QGraphicsSceneMouseEvent *event); |
|
1032 |
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); |
|
1033 |
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); |
|
1034 |
void contextMenuEvent(QGraphicsSceneContextMenuEvent *event); |
|
1035 |
void keyPressEvent(QKeyEvent *event); |
|
1036 |
void keyReleaseEvent(QKeyEvent *event); |
|
1037 |
void focusInEvent(QFocusEvent *event); |
|
1038 |
void focusOutEvent(QFocusEvent *event); |
|
1039 |
void dragEnterEvent(QGraphicsSceneDragDropEvent *event); |
|
1040 |
void dragLeaveEvent(QGraphicsSceneDragDropEvent *event); |
|
1041 |
void dragMoveEvent(QGraphicsSceneDragDropEvent *event); |
|
1042 |
void dropEvent(QGraphicsSceneDragDropEvent *event); |
|
1043 |
void inputMethodEvent(QInputMethodEvent *event); |
|
1044 |
void hoverEnterEvent(QGraphicsSceneHoverEvent *event); |
|
1045 |
void hoverMoveEvent(QGraphicsSceneHoverEvent *event); |
|
1046 |
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); |
|
1047 |
||
1048 |
QVariant inputMethodQuery(Qt::InputMethodQuery query) const; |
|
1049 |
||
1050 |
bool supportsExtension(Extension extension) const; |
|
1051 |
void setExtension(Extension extension, const QVariant &variant); |
|
1052 |
QVariant extension(const QVariant &variant) const; |
|
1053 |
||
1054 |
private: |
|
1055 |
Q_DISABLE_COPY(QGraphicsTextItem) |
|
1056 |
Q_PRIVATE_SLOT(dd, void _q_updateBoundingRect(const QSizeF &)) |
|
1057 |
Q_PRIVATE_SLOT(dd, void _q_update(QRectF)) |
|
1058 |
Q_PRIVATE_SLOT(dd, void _q_ensureVisible(QRectF)) |
|
1059 |
QGraphicsTextItemPrivate *dd; |
|
1060 |
friend class QGraphicsTextItemPrivate; |
|
1061 |
}; |
|
1062 |
||
1063 |
class QGraphicsSimpleTextItemPrivate; |
|
1064 |
class Q_GUI_EXPORT QGraphicsSimpleTextItem : public QAbstractGraphicsShapeItem |
|
1065 |
{ |
|
1066 |
public: |
|
1067 |
QGraphicsSimpleTextItem(QGraphicsItem *parent = 0 |
|
1068 |
#ifndef Q_QDOC |
|
1069 |
// ### obsolete argument |
|
1070 |
, QGraphicsScene *scene = 0 |
|
1071 |
#endif |
|
1072 |
); |
|
1073 |
QGraphicsSimpleTextItem(const QString &text, QGraphicsItem *parent = 0 |
|
1074 |
#ifndef Q_QDOC |
|
1075 |
// ### obsolete argument |
|
1076 |
, QGraphicsScene *scene = 0 |
|
1077 |
#endif |
|
1078 |
); |
|
1079 |
~QGraphicsSimpleTextItem(); |
|
1080 |
||
1081 |
void setText(const QString &text); |
|
1082 |
QString text() const; |
|
1083 |
||
1084 |
void setFont(const QFont &font); |
|
1085 |
QFont font() const; |
|
1086 |
||
1087 |
QRectF boundingRect() const; |
|
1088 |
QPainterPath shape() const; |
|
1089 |
bool contains(const QPointF &point) const; |
|
1090 |
||
1091 |
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); |
|
1092 |
||
1093 |
bool isObscuredBy(const QGraphicsItem *item) const; |
|
1094 |
QPainterPath opaqueArea() const; |
|
1095 |
||
1096 |
enum { Type = 9 }; |
|
1097 |
int type() const; |
|
1098 |
||
1099 |
protected: |
|
1100 |
bool supportsExtension(Extension extension) const; |
|
1101 |
void setExtension(Extension extension, const QVariant &variant); |
|
1102 |
QVariant extension(const QVariant &variant) const; |
|
1103 |
||
1104 |
private: |
|
1105 |
Q_DISABLE_COPY(QGraphicsSimpleTextItem) |
|
1106 |
Q_DECLARE_PRIVATE(QGraphicsSimpleTextItem) |
|
1107 |
}; |
|
1108 |
||
1109 |
class QGraphicsItemGroupPrivate; |
|
1110 |
class Q_GUI_EXPORT QGraphicsItemGroup : public QGraphicsItem |
|
1111 |
{ |
|
1112 |
public: |
|
1113 |
QGraphicsItemGroup(QGraphicsItem *parent = 0 |
|
1114 |
#ifndef Q_QDOC |
|
1115 |
// ### obsolete argument |
|
1116 |
, QGraphicsScene *scene = 0 |
|
1117 |
#endif |
|
1118 |
); |
|
1119 |
~QGraphicsItemGroup(); |
|
1120 |
||
1121 |
void addToGroup(QGraphicsItem *item); |
|
1122 |
void removeFromGroup(QGraphicsItem *item); |
|
1123 |
||
1124 |
QRectF boundingRect() const; |
|
1125 |
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); |
|
1126 |
||
1127 |
bool isObscuredBy(const QGraphicsItem *item) const; |
|
1128 |
QPainterPath opaqueArea() const; |
|
1129 |
||
1130 |
enum { Type = 10 }; |
|
1131 |
int type() const; |
|
1132 |
||
1133 |
private: |
|
1134 |
Q_DISABLE_COPY(QGraphicsItemGroup) |
|
1135 |
Q_DECLARE_PRIVATE(QGraphicsItemGroup) |
|
1136 |
}; |
|
1137 |
||
1138 |
template <class T> inline T qgraphicsitem_cast(QGraphicsItem *item) |
|
1139 |
{ |
|
1140 |
return int(static_cast<T>(0)->Type) == int(QGraphicsItem::Type) |
|
1141 |
|| (item && int(static_cast<T>(0)->Type) == item->type()) ? static_cast<T>(item) : 0; |
|
1142 |
} |
|
1143 |
||
1144 |
template <class T> inline T qgraphicsitem_cast(const QGraphicsItem *item) |
|
1145 |
{ |
|
1146 |
return int(static_cast<T>(0)->Type) == int(QGraphicsItem::Type) |
|
1147 |
|| (item && int(static_cast<T>(0)->Type) == item->type()) ? static_cast<T>(item) : 0; |
|
1148 |
} |
|
1149 |
||
1150 |
#ifndef QT_NO_DEBUG_STREAM |
|
1151 |
Q_GUI_EXPORT QDebug operator<<(QDebug debug, QGraphicsItem *item); |
|
1152 |
Q_GUI_EXPORT QDebug operator<<(QDebug debug, QGraphicsObject *item); |
|
1153 |
Q_GUI_EXPORT QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemChange change); |
|
1154 |
Q_GUI_EXPORT QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemFlag flag); |
|
1155 |
Q_GUI_EXPORT QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemFlags flags); |
|
1156 |
#endif |
|
1157 |
||
1158 |
QT_END_NAMESPACE |
|
1159 |
||
1160 |
Q_DECLARE_METATYPE(QGraphicsItem *) |
|
1161 |
Q_DECLARE_METATYPE(QGraphicsScene *) |
|
1162 |
||
1163 |
QT_BEGIN_NAMESPACE |
|
1164 |
||
1165 |
#endif // QT_NO_GRAPHICSVIEW |
|
1166 |
||
1167 |
QT_END_NAMESPACE |
|
1168 |
||
1169 |
QT_END_HEADER |
|
1170 |
||
1171 |
#endif // QGRAPHICSITEM_H |