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