- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- File List
- File Members

# qgraphicsitem.h

Go to the documentation of this file.

    00001 /****************************************************************************
    00002 **
    00003 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
    00004 ** All rights reserved.
    00005 ** Contact: Nokia Corporation (qt-info@nokia.com)
    00006 **
    00007 ** This file is part of the QtGui module of the Qt Toolkit.
    00008 **
    00009 ** $QT_BEGIN_LICENSE:LGPL$
    00010 ** Commercial Usage
    00011 ** Licensees holding valid Qt Commercial licenses may use this file in
    00012 ** accordance with the Qt Commercial License Agreement provided with the
    00013 ** Software or, alternatively, in accordance with the terms contained in
    00014 ** a written agreement between you and Nokia.
    00015 **
    00016 ** GNU Lesser General Public License Usage
    00017 ** Alternatively, this file may be used under the terms of the GNU Lesser
    00018 ** General Public License version 2.1 as published by the Free Software
    00019 ** Foundation and appearing in the file LICENSE.LGPL included in the
    00020 ** packaging of this file.  Please review the following information to
    00021 ** ensure the GNU Lesser General Public License version 2.1 requirements
    00022 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    00023 **
    00024 ** In addition, as a special exception, Nokia gives you certain additional
    00025 ** rights.  These rights are described in the Nokia Qt LGPL Exception
    00026 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this module.
    00027 **
    00028 ** GNU General Public License Usage
    00029 ** Alternatively, this file may be used under the terms of the GNU
    00030 ** General Public License version 3.0 as published by the Free Software
    00031 ** Foundation and appearing in the file LICENSE.GPL included in the
    00032 ** packaging of this file.  Please review the following information to
    00033 ** ensure the GNU General Public License version 3.0 requirements will be
    00034 ** met: http://www.gnu.org/copyleft/gpl.html.
    00035 **
    00036 ** If you have questions regarding the use of this file, please contact
    00037 ** Nokia at qt-info@nokia.com.
    00038 ** $QT_END_LICENSE$
    00039 **
    00040 ****************************************************************************/
    00041
    00042 #ifndef QGRAPHICSITEM_H
    00043 #define QGRAPHICSITEM_H
    00044
    00045 #include <QtCore/qglobal.h>
    00046 #include <QtCore/qobject.h>
    00047 #include <QtCore/qvariant.h>
    00048 #include <QtCore/qrect.h>
    00049 #include <QtCore/qscopedpointer.h>
    00050 #include <QtGui/qpainterpath.h>
    00051 #include <QtGui/qpixmap.h>
    00052
    00053 class tst_QGraphicsItem;
    00054
    00055 QT_BEGIN_HEADER
    00056
    00057 QT_BEGIN_NAMESPACE
    00058
    00059 QT_MODULE(Gui)
    00060
    00061 #if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
    00062
    00063 class QBrush;
    00064 class QCursor;
    00065 class QFocusEvent;
    00066 class QGraphicsEffect;
    00067 class QGraphicsItemGroup;
    00068 class QGraphicsObject;
    00069 class QGraphicsSceneContextMenuEvent;
    00070 class QGraphicsSceneDragDropEvent;
    00071 class QGraphicsSceneEvent;
    00072 class QGraphicsSceneHoverEvent;
    00073 class QGraphicsSceneMouseEvent;
    00074 class QGraphicsSceneWheelEvent;
    00075 class QGraphicsScene;
    00076 class QGraphicsTransform;
    00077 class QGraphicsWidget;
    00078 class QInputMethodEvent;
    00079 class QKeyEvent;
    00080 class QMatrix;
    00081 class QMenu;
    00082 class QPainter;
    00083 class QPen;
    00084 class QPointF;
    00085 class QRectF;
    00086 class QStyleOptionGraphicsItem;
    00087
    00088 class QGraphicsItemPrivate;
    00089 class Q_GUI_EXPORT QGraphicsItem
    00090 {
    00091 public:
    00092     enum GraphicsItemFlag {
    00093         ItemIsMovable = 0x1,
    00094         ItemIsSelectable = 0x2,
    00095         ItemIsFocusable = 0x4,
    00096         ItemClipsToShape = 0x8,
    00097         ItemClipsChildrenToShape = 0x10,
    00098         ItemIgnoresTransformations = 0x20,
    00099         ItemIgnoresParentOpacity = 0x40,
    00100         ItemDoesntPropagateOpacityToChildren = 0x80,
    00101         ItemStacksBehindParent = 0x100,
    00102         ItemUsesExtendedStyleOption = 0x200,
    00103         ItemHasNoContents = 0x400,
    00104         ItemSendsGeometryChanges = 0x800,
    00105         ItemAcceptsInputMethod = 0x1000,
    00106         ItemNegativeZStacksBehindParent = 0x2000,
    00107         ItemIsPanel = 0x4000,
    00108         ItemIsFocusScope = 0x8000, // internal
    00109         ItemSendsScenePositionChanges = 0x10000,
    00110         ItemStopsClickFocusPropagation = 0x20000
    00111         // NB! Don't forget to increase the d_ptr->flags bit field by 1 when adding a new flag.
    00112     };
    00113     Q_DECLARE_FLAGS(GraphicsItemFlags, GraphicsItemFlag)
    00114
    00115     enum GraphicsItemChange {
    00116         ItemPositionChange,
    00117         ItemMatrixChange,
    00118         ItemVisibleChange,
    00119         ItemEnabledChange,
    00120         ItemSelectedChange,
    00121         ItemParentChange,
    00122         ItemChildAddedChange,
    00123         ItemChildRemovedChange,
    00124         ItemTransformChange,
    00125         ItemPositionHasChanged,
    00126         ItemTransformHasChanged,
    00127         ItemSceneChange,
    00128         ItemVisibleHasChanged,
    00129         ItemEnabledHasChanged,
    00130         ItemSelectedHasChanged,
    00131         ItemParentHasChanged,
    00132         ItemSceneHasChanged,
    00133         ItemCursorChange,
    00134         ItemCursorHasChanged,
    00135         ItemToolTipChange,
    00136         ItemToolTipHasChanged,
    00137         ItemFlagsChange,
    00138         ItemFlagsHaveChanged,
    00139         ItemZValueChange,
    00140         ItemZValueHasChanged,
    00141         ItemOpacityChange,
    00142         ItemOpacityHasChanged,
    00143         ItemScenePositionHasChanged,
    00144         ItemRotationChange,
    00145         ItemRotationHasChanged,
    00146         ItemScaleChange,
    00147         ItemScaleHasChanged,
    00148         ItemTransformOriginPointChange,
    00149         ItemTransformOriginPointHasChanged
    00150     };
    00151
    00152     enum CacheMode {
    00153         NoCache,
    00154         ItemCoordinateCache,
    00155         DeviceCoordinateCache
    00156     };
    00157
    00158     enum PanelModality
    00159     {
    00160         NonModal,
    00161         PanelModal,
    00162         SceneModal
    00163     };
    00164
    00165     QGraphicsItem(QGraphicsItem *parent = 0
    00166 #ifndef Q_QDOC
    00167                   // ### obsolete argument
    00168                   , QGraphicsScene *scene = 0
    00169 #endif
    00170         );
    00171     virtual ~QGraphicsItem();
    00172
    00173     QGraphicsScene *scene() const;
    00174
    00175     QGraphicsItem *parentItem() const;
    00176     QGraphicsItem *topLevelItem() const;
    00177     QGraphicsObject *parentObject() const;
    00178     QGraphicsWidget *parentWidget() const;
    00179     QGraphicsWidget *topLevelWidget() const;
    00180     QGraphicsWidget *window() const;
    00181     QGraphicsItem *panel() const;
    00182     void setParentItem(QGraphicsItem *parent);
    00183     QList<QGraphicsItem *> children() const; // ### obsolete
    00184     QList<QGraphicsItem *> childItems() const;
    00185     bool isWidget() const;
    00186     bool isWindow() const;
    00187     bool isPanel() const;
    00188
    00189     QGraphicsObject *toGraphicsObject();
    00190     const QGraphicsObject *toGraphicsObject() const;
    00191
    00192     QGraphicsItemGroup *group() const;
    00193     void setGroup(QGraphicsItemGroup *group);
    00194
    00195     GraphicsItemFlags flags() const;
    00196     void setFlag(GraphicsItemFlag flag, bool enabled = true);
    00197     void setFlags(GraphicsItemFlags flags);
    00198
    00199     CacheMode cacheMode() const;
    00200     void setCacheMode(CacheMode mode, const QSize &cacheSize = QSize());
    00201
    00202     PanelModality panelModality() const;
    00203     void setPanelModality(PanelModality panelModality);
    00204     bool isBlockedByModalPanel(QGraphicsItem **blockingPanel = 0) const;
    00205
    00206 #ifndef QT_NO_TOOLTIP
    00207     QString toolTip() const;
    00208     void setToolTip(const QString &toolTip);
    00209 #endif
    00210
    00211 #ifndef QT_NO_CURSOR
    00212     QCursor cursor() const;
    00213     void setCursor(const QCursor &cursor);
    00214     bool hasCursor() const;
    00215     void unsetCursor();
    00216 #endif
    00217
    00218     bool isVisible() const;
    00219     bool isVisibleTo(const QGraphicsItem *parent) const;
    00220     void setVisible(bool visible);
    00221     inline void hide() { setVisible(false); }
    00222     inline void show() { setVisible(true); }
    00223
    00224     bool isEnabled() const;
    00225     void setEnabled(bool enabled);
    00226
    00227     bool isSelected() const;
    00228     void setSelected(bool selected);
    00229
    00230     bool acceptDrops() const;
    00231     void setAcceptDrops(bool on);
    00232
    00233     qreal opacity() const;
    00234     qreal effectiveOpacity() const;
    00235     void setOpacity(qreal opacity);
    00236
    00237 #ifndef QT_NO_GRAPHICSEFFECT
    00238     // Effect
    00239     QGraphicsEffect *graphicsEffect() const;
    00240     void setGraphicsEffect(QGraphicsEffect *effect);
    00241 #endif //QT_NO_GRAPHICSEFFECT
    00242
    00243     Qt::MouseButtons acceptedMouseButtons() const;
    00244     void setAcceptedMouseButtons(Qt::MouseButtons buttons);
    00245
    00246     bool acceptsHoverEvents() const; // ### obsolete
    00247     void setAcceptsHoverEvents(bool enabled); // ### obsolete
    00248     bool acceptHoverEvents() const;
    00249     void setAcceptHoverEvents(bool enabled);
    00250     bool acceptTouchEvents() const;
    00251     void setAcceptTouchEvents(bool enabled);
    00252
    00253     bool filtersChildEvents() const;
    00254     void setFiltersChildEvents(bool enabled);
    00255
    00256     bool handlesChildEvents() const;
    00257     void setHandlesChildEvents(bool enabled);
    00258
    00259     bool isActive() const;
    00260     void setActive(bool active);
    00261
    00262     bool hasFocus() const;
    00263     void setFocus(Qt::FocusReason focusReason = Qt::OtherFocusReason);
    00264     void clearFocus();
    00265
    00266     QGraphicsItem *focusProxy() const;
    00267     void setFocusProxy(QGraphicsItem *item);
    00268
    00269     QGraphicsItem *focusItem() const;
    00270     QGraphicsItem *focusScopeItem() const;
    00271
    00272     void grabMouse();
    00273     void ungrabMouse();
    00274     void grabKeyboard();
    00275     void ungrabKeyboard();
    00276
    00277     // Positioning in scene coordinates
    00278     QPointF pos() const;
    00279     inline qreal x() const { return pos().x(); }
    00280     void setX(qreal x);
    00281     inline qreal y() const { return pos().y(); }
    00282     void setY(qreal y);
    00283     QPointF scenePos() const;
    00284     void setPos(const QPointF &pos);
    00285     inline void setPos(qreal x, qreal y);
    00286     inline void moveBy(qreal dx, qreal dy) { setPos(pos().x() + dx, pos().y() + dy); }
    00287
    00288     void ensureVisible(const QRectF &rect = QRectF(), int xmargin = 50, int ymargin = 50);
    00289     inline void ensureVisible(qreal x, qreal y, qreal w, qreal h, int xmargin = 50, int ymargin = 50);
    00290
    00291     // Local transformation
    00292     QMatrix matrix() const;
    00293     QMatrix sceneMatrix() const;
    00294     void setMatrix(const QMatrix &matrix, bool combine = false);
    00295     void resetMatrix();
    00296     QTransform transform() const;
    00297     QTransform sceneTransform() const;
    00298     QTransform deviceTransform(const QTransform &viewportTransform) const;
    00299     QTransform itemTransform(const QGraphicsItem *other, bool *ok = 0) const;
    00300     void setTransform(const QTransform &matrix, bool combine = false);
    00301     void resetTransform();
    00302
    00303     void rotate(qreal angle);           // ### obsolete
    00304     void scale(qreal sx, qreal sy);     // ### obsolete
    00305     void shear(qreal sh, qreal sv);     // ### obsolete
    00306     void translate(qreal dx, qreal dy); // ### obsolete
    00307
    00308     void setRotation(qreal angle);
    00309     qreal rotation() const;
    00310
    00311     void setScale(qreal scale);
    00312     qreal scale() const;
    00313
    00314     QList<QGraphicsTransform *> transformations() const;
    00315     void setTransformations(const QList<QGraphicsTransform *> &transformations);
    00316
    00317     QPointF transformOriginPoint() const;
    00318     void setTransformOriginPoint(const QPointF &origin);
    00319     inline void setTransformOriginPoint(qreal ax, qreal ay)
    00320     { setTransformOriginPoint(QPointF(ax,ay)); }
    00321
    00322     virtual void advance(int phase);
    00323
    00324     // Stacking order
    00325     qreal zValue() const;
    00326     void setZValue(qreal z);
    00327     void stackBefore(const QGraphicsItem *sibling);
    00328
    00329     // Hit test
    00330     virtual QRectF boundingRect() const = 0;
    00331     QRectF childrenBoundingRect() const;
    00332     QRectF sceneBoundingRect() const;
    00333     virtual QPainterPath shape() const;
    00334     bool isClipped() const;
    00335     QPainterPath clipPath() const;
    00336     virtual bool contains(const QPointF &point) const;
    00337     virtual bool collidesWithItem(const QGraphicsItem *other, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const;
    00338     virtual bool collidesWithPath(const QPainterPath &path, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const;
    00339     QList<QGraphicsItem *> collidingItems(Qt::ItemSelectionMode mode = Qt::IntersectsItemShape) const;
    00340     bool isObscured() const;
    00341     bool isObscured(const QRectF &rect) const; // ### Qt 5: merge with isObscured(), add QRectF arg to isObscuredBy()
    00342     inline bool isObscured(qreal x, qreal y, qreal w, qreal h) const;
    00343     virtual bool isObscuredBy(const QGraphicsItem *item) const;
    00344     virtual QPainterPath opaqueArea() const;
    00345
    00346     QRegion boundingRegion(const QTransform &itemToDeviceTransform) const;
    00347     qreal boundingRegionGranularity() const;
    00348     void setBoundingRegionGranularity(qreal granularity);
    00349
    00350     // Drawing
    00351     virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) = 0;
    00352     void update(const QRectF &rect = QRectF());
    00353     inline void update(qreal x, qreal y, qreal width, qreal height);
    00354     void scroll(qreal dx, qreal dy, const QRectF &rect = QRectF());
    00355
    00356     // Coordinate mapping
    00357     QPointF mapToItem(const QGraphicsItem *item, const QPointF &point) const;
    00358     QPointF mapToParent(const QPointF &point) const;
    00359     QPointF mapToScene(const QPointF &point) const;
    00360     QPolygonF mapToItem(const QGraphicsItem *item, const QRectF &rect) const;
    00361     QPolygonF mapToParent(const QRectF &rect) const;
    00362     QPolygonF mapToScene(const QRectF &rect) const;
    00363     QRectF mapRectToItem(const QGraphicsItem *item, const QRectF &rect) const;
    00364     QRectF mapRectToParent(const QRectF &rect) const;
    00365     QRectF mapRectToScene(const QRectF &rect) const;
    00366     QPolygonF mapToItem(const QGraphicsItem *item, const QPolygonF &polygon) const;
    00367     QPolygonF mapToParent(const QPolygonF &polygon) const;
    00368     QPolygonF mapToScene(const QPolygonF &polygon) const;
    00369     QPainterPath mapToItem(const QGraphicsItem *item, const QPainterPath &path) const;
    00370     QPainterPath mapToParent(const QPainterPath &path) const;
    00371     QPainterPath mapToScene(const QPainterPath &path) const;
    00372     QPointF mapFromItem(const QGraphicsItem *item, const QPointF &point) const;
    00373     QPointF mapFromParent(const QPointF &point) const;
    00374     QPointF mapFromScene(const QPointF &point) const;
    00375     QPolygonF mapFromItem(const QGraphicsItem *item, const QRectF &rect) const;
    00376     QPolygonF mapFromParent(const QRectF &rect) const;
    00377     QPolygonF mapFromScene(const QRectF &rect) const;
    00378     QRectF mapRectFromItem(const QGraphicsItem *item, const QRectF &rect) const;
    00379     QRectF mapRectFromParent(const QRectF &rect) const;
    00380     QRectF mapRectFromScene(const QRectF &rect) const;
    00381     QPolygonF mapFromItem(const QGraphicsItem *item, const QPolygonF &polygon) const;
    00382     QPolygonF mapFromParent(const QPolygonF &polygon) const;
    00383     QPolygonF mapFromScene(const QPolygonF &polygon) const;
    00384     QPainterPath mapFromItem(const QGraphicsItem *item, const QPainterPath &path) const;
    00385     QPainterPath mapFromParent(const QPainterPath &path) const;
    00386     QPainterPath mapFromScene(const QPainterPath &path) const;
    00387
    00388     inline QPointF mapToItem(const QGraphicsItem *item, qreal x, qreal y) const;
    00389     inline QPointF mapToParent(qreal x, qreal y) const;
    00390     inline QPointF mapToScene(qreal x, qreal y) const;
    00391     inline QPolygonF mapToItem(const QGraphicsItem *item, qreal x, qreal y, qreal w, qreal h) const;
    00392     inline QPolygonF mapToParent(qreal x, qreal y, qreal w, qreal h) const;
    00393     inline QPolygonF mapToScene(qreal x, qreal y, qreal w, qreal h) const;
    00394     inline QRectF mapRectToItem(const QGraphicsItem *item, qreal x, qreal y, qreal w, qreal h) const;
    00395     inline QRectF mapRectToParent(qreal x, qreal y, qreal w, qreal h) const;
    00396     inline QRectF mapRectToScene(qreal x, qreal y, qreal w, qreal h) const;
    00397     inline QPointF mapFromItem(const QGraphicsItem *item, qreal x, qreal y) const;
    00398     inline QPointF mapFromParent(qreal x, qreal y) const;
    00399     inline QPointF mapFromScene(qreal x, qreal y) const;
    00400     inline QPolygonF mapFromItem(const QGraphicsItem *item, qreal x, qreal y, qreal w, qreal h) const;
    00401     inline QPolygonF mapFromParent(qreal x, qreal y, qreal w, qreal h) const;
    00402     inline QPolygonF mapFromScene(qreal x, qreal y, qreal w, qreal h) const;
    00403     inline QRectF mapRectFromItem(const QGraphicsItem *item, qreal x, qreal y, qreal w, qreal h) const;
    00404     inline QRectF mapRectFromParent(qreal x, qreal y, qreal w, qreal h) const;
    00405     inline QRectF mapRectFromScene(qreal x, qreal y, qreal w, qreal h) const;
    00406
    00407     bool isAncestorOf(const QGraphicsItem *child) const;
    00408     QGraphicsItem *commonAncestorItem(const QGraphicsItem *other) const;
    00409     bool isUnderMouse() const;
    00410
    00411     // Custom data
    00412     QVariant data(int key) const;
    00413     void setData(int key, const QVariant &value);
    00414
    00415     Qt::InputMethodHints inputMethodHints() const;
    00416     void setInputMethodHints(Qt::InputMethodHints hints);
    00417
    00418     enum {
    00419         Type = 1,
    00420         UserType = 65536
    00421     };
    00422     virtual int type() const;
    00423
    00424     void installSceneEventFilter(QGraphicsItem *filterItem);
    00425     void removeSceneEventFilter(QGraphicsItem *filterItem);
    00426
    00427 protected:
    00428     void updateMicroFocus();
    00429     virtual bool sceneEventFilter(QGraphicsItem *watched, QEvent *event);
    00430     virtual bool sceneEvent(QEvent *event);
    00431     virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
    00432     virtual void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
    00433     virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
    00434     virtual void dragMoveEvent(QGraphicsSceneDragDropEvent *event);
    00435     virtual void dropEvent(QGraphicsSceneDragDropEvent *event);
    00436     virtual void focusInEvent(QFocusEvent *event);
    00437     virtual void focusOutEvent(QFocusEvent *event);
    00438     virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
    00439     virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
    00440     virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
    00441     virtual void keyPressEvent(QKeyEvent *event);
    00442     virtual void keyReleaseEvent(QKeyEvent *event);
    00443     virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
    00444     virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
    00445     virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
    00446     virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
    00447     virtual void wheelEvent(QGraphicsSceneWheelEvent *event);
    00448     virtual void inputMethodEvent(QInputMethodEvent *event);
    00449     virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
    00450
    00451     virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
    00452
    00453     enum Extension {
    00454         UserExtension = 0x80000000
    00455     };
    00456     virtual bool supportsExtension(Extension extension) const;
    00457     virtual void setExtension(Extension extension, const QVariant &variant);
    00458     virtual QVariant extension(const QVariant &variant) const;
    00459
    00460 protected:
    00461     QGraphicsItem(QGraphicsItemPrivate &dd,
    00462                   QGraphicsItem *parent, QGraphicsScene *scene);
    00463     QScopedPointer<QGraphicsItemPrivate> d_ptr;
    00464
    00465     void addToIndex();
    00466     void removeFromIndex();
    00467     void prepareGeometryChange();
    00468
    00469 private:
    00470     Q_DISABLE_COPY(QGraphicsItem)
    00471     Q_DECLARE_PRIVATE(QGraphicsItem)
    00472     friend class QGraphicsItemGroup;
    00473     friend class QGraphicsScene;
    00474     friend class QGraphicsScenePrivate;
    00475     friend class QGraphicsSceneFindItemBspTreeVisitor;
    00476     friend class QGraphicsSceneBspTree;
    00477     friend class QGraphicsView;
    00478     friend class QGraphicsViewPrivate;
    00479     friend class QGraphicsObject;
    00480     friend class QGraphicsWidget;
    00481     friend class QGraphicsWidgetPrivate;
    00482     friend class QGraphicsProxyWidgetPrivate;
    00483     friend class QGraphicsSceneIndex;
    00484     friend class QGraphicsSceneIndexPrivate;
    00485     friend class QGraphicsSceneBspTreeIndex;
    00486     friend class QGraphicsSceneBspTreeIndexPrivate;
    00487     friend class QGraphicsItemEffectSourcePrivate;
    00488     friend class QGraphicsTransformPrivate;
    00489 #ifndef QT_NO_GESTURES
    00490     friend class QGestureManager;
    00491 #endif
    00492     friend class ::tst_QGraphicsItem;
    00493     friend bool qt_closestLeaf(const QGraphicsItem *, const QGraphicsItem *);
    00494     friend bool qt_closestItemFirst(const QGraphicsItem *, const QGraphicsItem *);
    00495 };
    00496
    00497 Q_DECLARE_OPERATORS_FOR_FLAGS(QGraphicsItem::GraphicsItemFlags)
    00498 Q_DECLARE_INTERFACE(QGraphicsItem, "com.trolltech.Qt.QGraphicsItem")
    00499
    00500 inline void QGraphicsItem::setPos(qreal ax, qreal ay)
    00501 { setPos(QPointF(ax, ay)); }
    00502 inline void QGraphicsItem::ensureVisible(qreal ax, qreal ay, qreal w, qreal h, int xmargin, int ymargin)
    00503 { ensureVisible(QRectF(ax, ay, w, h), xmargin, ymargin); }
    00504 inline void QGraphicsItem::update(qreal ax, qreal ay, qreal width, qreal height)
    00505 { update(QRectF(ax, ay, width, height)); }
    00506 inline bool QGraphicsItem::isObscured(qreal ax, qreal ay, qreal w, qreal h) const
    00507 { return isObscured(QRectF(ax, ay, w, h)); }
    00508 inline QPointF QGraphicsItem::mapToItem(const QGraphicsItem *item, qreal ax, qreal ay) const
    00509 { return mapToItem(item, QPointF(ax, ay)); }
    00510 inline QPointF QGraphicsItem::mapToParent(qreal ax, qreal ay) const
    00511 { return mapToParent(QPointF(ax, ay)); }
    00512 inline QPointF QGraphicsItem::mapToScene(qreal ax, qreal ay) const
    00513 { return mapToScene(QPointF(ax, ay));  }
    00514 inline QPointF QGraphicsItem::mapFromItem(const QGraphicsItem *item, qreal ax, qreal ay) const
    00515 { return mapFromItem(item, QPointF(ax, ay)); }
    00516 inline QPointF QGraphicsItem::mapFromParent(qreal ax, qreal ay) const
    00517 { return mapFromParent(QPointF(ax, ay));  }
    00518 inline QPointF QGraphicsItem::mapFromScene(qreal ax, qreal ay) const
    00519 { return mapFromScene(QPointF(ax, ay));  }
    00520 inline QPolygonF QGraphicsItem::mapToItem(const QGraphicsItem *item, qreal ax, qreal ay, qreal w, qreal h) const
    00521 { return mapToItem(item, QRectF(ax, ay, w, h)); }
    00522 inline QPolygonF QGraphicsItem::mapToParent(qreal ax, qreal ay, qreal w, qreal h) const
    00523 { return mapToParent(QRectF(ax, ay, w, h)); }
    00524 inline QPolygonF QGraphicsItem::mapToScene(qreal ax, qreal ay, qreal w, qreal h) const
    00525 { return mapToScene(QRectF(ax, ay, w, h)); }
    00526 inline QRectF QGraphicsItem::mapRectToItem(const QGraphicsItem *item, qreal ax, qreal ay, qreal w, qreal h) const
    00527 { return mapRectToItem(item, QRectF(ax, ay, w, h)); }
    00528 inline QRectF QGraphicsItem::mapRectToParent(qreal ax, qreal ay, qreal w, qreal h) const
    00529 { return mapRectToParent(QRectF(ax, ay, w, h)); }
    00530 inline QRectF QGraphicsItem::mapRectToScene(qreal ax, qreal ay, qreal w, qreal h) const
    00531 { return mapRectToScene(QRectF(ax, ay, w, h)); }
    00532 inline QPolygonF QGraphicsItem::mapFromItem(const QGraphicsItem *item, qreal ax, qreal ay, qreal w, qreal h) const
    00533 { return mapFromItem(item, QRectF(ax, ay, w, h)); }
    00534 inline QPolygonF QGraphicsItem::mapFromParent(qreal ax, qreal ay, qreal w, qreal h) const
    00535 { return mapFromParent(QRectF(ax, ay, w, h)); }
    00536 inline QPolygonF QGraphicsItem::mapFromScene(qreal ax, qreal ay, qreal w, qreal h) const
    00537 { return mapFromScene(QRectF(ax, ay, w, h)); }
    00538 inline QRectF QGraphicsItem::mapRectFromItem(const QGraphicsItem *item, qreal ax, qreal ay, qreal w, qreal h) const
    00539 { return mapRectFromItem(item, QRectF(ax, ay, w, h)); }
    00540 inline QRectF QGraphicsItem::mapRectFromParent(qreal ax, qreal ay, qreal w, qreal h) const
    00541 { return mapRectFromParent(QRectF(ax, ay, w, h)); }
    00542 inline QRectF QGraphicsItem::mapRectFromScene(qreal ax, qreal ay, qreal w, qreal h) const
    00543 { return mapRectFromScene(QRectF(ax, ay, w, h)); }
    00544
    00545
    00546 class Q_GUI_EXPORT QGraphicsObject : public QObject, public QGraphicsItem
    00547 {
    00548     Q_OBJECT
    00549     Q_PROPERTY(QGraphicsObject * parent READ parentObject WRITE setParentItem NOTIFY parentChanged DESIGNABLE false)
    00550     Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged FINAL)
    00551     Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged)
    00552     Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged FINAL)
    00553     Q_PROPERTY(QPointF pos READ pos WRITE setPos FINAL)
    00554     Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged FINAL)
    00555     Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged FINAL)
    00556     Q_PROPERTY(qreal z READ zValue WRITE setZValue NOTIFY zChanged FINAL)
    00557     Q_PROPERTY(qreal rotation READ rotation WRITE setRotation NOTIFY rotationChanged)
    00558     Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged)
    00559     Q_PROPERTY(QPointF transformOriginPoint READ transformOriginPoint WRITE setTransformOriginPoint)
    00560 #ifndef QT_NO_GRAPHICSEFFECT
    00561     Q_PROPERTY(QGraphicsEffect *effect READ graphicsEffect WRITE setGraphicsEffect)
    00562 #endif
    00563     Q_PRIVATE_PROPERTY(QGraphicsItem::d_func(), QDeclarativeListProperty<QGraphicsObject> children READ childrenList DESIGNABLE false NOTIFY childrenChanged)
    00564     Q_PRIVATE_PROPERTY(QGraphicsItem::d_func(), qreal width READ width WRITE setWidth NOTIFY widthChanged RESET resetWidth FINAL)
    00565     Q_PRIVATE_PROPERTY(QGraphicsItem::d_func(), qreal height READ height WRITE setHeight NOTIFY heightChanged RESET resetHeight FINAL)
    00566     Q_CLASSINFO("DefaultProperty", "children")
    00567     Q_INTERFACES(QGraphicsItem)
    00568 public:
    00569     QGraphicsObject(QGraphicsItem *parent = 0);
    00570
    00571     // ### Qt 5: Disambiguate
    00572 #ifdef Q_NO_USING_KEYWORD
    00573     const QObjectList &children() const { return QObject::children(); }
    00574 #else
    00575     using QObject::children;
    00576 #endif
    00577
    00578 #ifndef QT_NO_GESTURES
    00579     void grabGesture(Qt::GestureType type, Qt::GestureFlags flags = Qt::GestureFlags());
    00580     void ungrabGesture(Qt::GestureType type);
    00581 #endif
    00582
    00583 protected Q_SLOTS:
    00584     void updateMicroFocus();
    00585
    00586 Q_SIGNALS:
    00587     void parentChanged();
    00588     void opacityChanged();
    00589     void visibleChanged();
    00590     void enabledChanged();
    00591     void xChanged();
    00592     void yChanged();
    00593     void zChanged();
    00594     void rotationChanged();
    00595     void scaleChanged();
    00596     void childrenChanged();
    00597     void widthChanged();
    00598     void heightChanged();
    00599
    00600 protected:
    00601     QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent, QGraphicsScene *scene);
    00602 private:
    00603     friend class QGraphicsItem;
    00604     friend class QGraphicsItemPrivate;
    00605 };
    00606
    00607
    00608 class QAbstractGraphicsShapeItemPrivate;
    00609 class Q_GUI_EXPORT QAbstractGraphicsShapeItem : public QGraphicsItem
    00610 {
    00611 public:
    00612     QAbstractGraphicsShapeItem(QGraphicsItem *parent = 0
    00613 #ifndef Q_QDOC
    00614                                // ### obsolete argument
    00615                                , QGraphicsScene *scene = 0
    00616 #endif
    00617         );
    00618     ~QAbstractGraphicsShapeItem();
    00619
    00620     QPen pen() const;
    00621     void setPen(const QPen &pen);
    00622
    00623     QBrush brush() const;
    00624     void setBrush(const QBrush &brush);
    00625
    00626     bool isObscuredBy(const QGraphicsItem *item) const;
    00627     QPainterPath opaqueArea() const;
    00628
    00629 protected:
    00630     QAbstractGraphicsShapeItem(QAbstractGraphicsShapeItemPrivate &dd,
    00631                                QGraphicsItem *parent, QGraphicsScene *scene);
    00632
    00633 private:
    00634     Q_DISABLE_COPY(QAbstractGraphicsShapeItem)
    00635     Q_DECLARE_PRIVATE(QAbstractGraphicsShapeItem)
    00636 };
    00637
    00638 class QGraphicsPathItemPrivate;
    00639 class Q_GUI_EXPORT QGraphicsPathItem : public QAbstractGraphicsShapeItem
    00640 {
    00641 public:
    00642     QGraphicsPathItem(QGraphicsItem *parent = 0
    00643 #ifndef Q_QDOC
    00644                       // ### obsolete argument
    00645                       , QGraphicsScene *scene = 0
    00646 #endif
    00647         );
    00648     QGraphicsPathItem(const QPainterPath &path, QGraphicsItem *parent = 0
    00649 #ifndef Q_QDOC
    00650                       // ### obsolete argument
    00651                       , QGraphicsScene *scene = 0
    00652 #endif
    00653         );
    00654     ~QGraphicsPathItem();
    00655
    00656     QPainterPath path() const;
    00657     void setPath(const QPainterPath &path);
    00658
    00659     QRectF boundingRect() const;
    00660     QPainterPath shape() const;
    00661     bool contains(const QPointF &point) const;
    00662
    00663     void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
    00664
    00665     bool isObscuredBy(const QGraphicsItem *item) const;
    00666     QPainterPath opaqueArea() const;
    00667
    00668     enum { Type = 2 };
    00669     int type() const;
    00670
    00671 protected:
    00672     bool supportsExtension(Extension extension) const;
    00673     void setExtension(Extension extension, const QVariant &variant);
    00674     QVariant extension(const QVariant &variant) const;
    00675
    00676 private:
    00677     Q_DISABLE_COPY(QGraphicsPathItem)
    00678     Q_DECLARE_PRIVATE(QGraphicsPathItem)
    00679 };
    00680
    00681 class QGraphicsRectItemPrivate;
    00682 class Q_GUI_EXPORT QGraphicsRectItem : public QAbstractGraphicsShapeItem
    00683 {
    00684 public:
    00685     QGraphicsRectItem(QGraphicsItem *parent = 0
    00686 #ifndef Q_QDOC
    00687                       // ### obsolete argument
    00688                       , QGraphicsScene *scene = 0
    00689 #endif
    00690         );
    00691     QGraphicsRectItem(const QRectF &rect, QGraphicsItem *parent = 0
    00692 #ifndef Q_QDOC
    00693                       // ### obsolete argument
    00694                       , QGraphicsScene *scene = 0
    00695 #endif
    00696         );
    00697     QGraphicsRectItem(qreal x, qreal y, qreal w, qreal h, QGraphicsItem *parent = 0
    00698 #ifndef Q_QDOC
    00699                       // ### obsolete argument
    00700                       , QGraphicsScene *scene = 0
    00701 #endif
    00702         );
    00703     ~QGraphicsRectItem();
    00704
    00705     QRectF rect() const;
    00706     void setRect(const QRectF &rect);
    00707     inline void setRect(qreal x, qreal y, qreal w, qreal h);
    00708
    00709     QRectF boundingRect() const;
    00710     QPainterPath shape() const;
    00711     bool contains(const QPointF &point) const;
    00712
    00713     void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
    00714
    00715     bool isObscuredBy(const QGraphicsItem *item) const;
    00716     QPainterPath opaqueArea() const;
    00717
    00718     enum { Type = 3 };
    00719     int type() const;
    00720
    00721 protected:
    00722     bool supportsExtension(Extension extension) const;
    00723     void setExtension(Extension extension, const QVariant &variant);
    00724     QVariant extension(const QVariant &variant) const;
    00725
    00726 private:
    00727     Q_DISABLE_COPY(QGraphicsRectItem)
    00728     Q_DECLARE_PRIVATE(QGraphicsRectItem)
    00729 };
    00730
    00731 inline void QGraphicsRectItem::setRect(qreal ax, qreal ay, qreal w, qreal h)
    00732 { setRect(QRectF(ax, ay, w, h)); }
    00733
    00734 class QGraphicsEllipseItemPrivate;
    00735 class Q_GUI_EXPORT QGraphicsEllipseItem : public QAbstractGraphicsShapeItem
    00736 {
    00737 public:
    00738     QGraphicsEllipseItem(QGraphicsItem *parent = 0
    00739 #ifndef Q_QDOC
    00740                          // ### obsolete argument
    00741                          , QGraphicsScene *scene = 0
    00742 #endif
    00743         );
    00744     QGraphicsEllipseItem(const QRectF &rect, QGraphicsItem *parent = 0
    00745 #ifndef Q_QDOC
    00746                          // ### obsolete argument
    00747                          , QGraphicsScene *scene = 0
    00748 #endif
    00749         );
    00750     QGraphicsEllipseItem(qreal x, qreal y, qreal w, qreal h, QGraphicsItem *parent = 0
    00751 #ifndef Q_QDOC
    00752                          // ### obsolete argument
    00753                          , QGraphicsScene *scene = 0
    00754 #endif
    00755         );
    00756     ~QGraphicsEllipseItem();
    00757
    00758     QRectF rect() const;
    00759     void setRect(const QRectF &rect);
    00760     inline void setRect(qreal x, qreal y, qreal w, qreal h);
    00761
    00762     int startAngle() const;
    00763     void setStartAngle(int angle);
    00764
    00765     int spanAngle() const;
    00766     void setSpanAngle(int angle);
    00767
    00768     QRectF boundingRect() const;
    00769     QPainterPath shape() const;
    00770     bool contains(const QPointF &point) const;
    00771
    00772     void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
    00773
    00774     bool isObscuredBy(const QGraphicsItem *item) const;
    00775     QPainterPath opaqueArea() const;
    00776
    00777     enum { Type = 4 };
    00778     int type() const;
    00779
    00780 protected:
    00781     bool supportsExtension(Extension extension) const;
    00782     void setExtension(Extension extension, const QVariant &variant);
    00783     QVariant extension(const QVariant &variant) const;
    00784
    00785 private:
    00786     Q_DISABLE_COPY(QGraphicsEllipseItem)
    00787     Q_DECLARE_PRIVATE(QGraphicsEllipseItem)
    00788 };
    00789
    00790 inline void QGraphicsEllipseItem::setRect(qreal ax, qreal ay, qreal w, qreal h)
    00791 { setRect(QRectF(ax, ay, w, h)); }
    00792
    00793 class QGraphicsPolygonItemPrivate;
    00794 class Q_GUI_EXPORT QGraphicsPolygonItem : public QAbstractGraphicsShapeItem
    00795 {
    00796 public:
    00797     QGraphicsPolygonItem(QGraphicsItem *parent = 0
    00798 #ifndef Q_QDOC
    00799                          // ### obsolete argument
    00800                          , QGraphicsScene *scene = 0
    00801 #endif
    00802         );
    00803     QGraphicsPolygonItem(const QPolygonF &polygon,
    00804                          QGraphicsItem *parent = 0
    00805 #ifndef Q_QDOC
    00806                          // ### obsolete argument
    00807                          , QGraphicsScene *scene = 0
    00808 #endif
    00809         );
    00810     ~QGraphicsPolygonItem();
    00811
    00812     QPolygonF polygon() const;
    00813     void setPolygon(const QPolygonF &polygon);
    00814
    00815     Qt::FillRule fillRule() const;
    00816     void setFillRule(Qt::FillRule rule);
    00817
    00818     QRectF boundingRect() const;
    00819     QPainterPath shape() const;
    00820     bool contains(const QPointF &point) const;
    00821
    00822     void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
    00823
    00824     bool isObscuredBy(const QGraphicsItem *item) const;
    00825     QPainterPath opaqueArea() const;
    00826
    00827     enum { Type = 5 };
    00828     int type() const;
    00829
    00830 protected:
    00831     bool supportsExtension(Extension extension) const;
    00832     void setExtension(Extension extension, const QVariant &variant);
    00833     QVariant extension(const QVariant &variant) const;
    00834
    00835 private:
    00836     Q_DISABLE_COPY(QGraphicsPolygonItem)
    00837     Q_DECLARE_PRIVATE(QGraphicsPolygonItem)
    00838 };
    00839
    00840 class QGraphicsLineItemPrivate;
    00841 class Q_GUI_EXPORT QGraphicsLineItem : public QGraphicsItem
    00842 {
    00843 public:
    00844     QGraphicsLineItem(QGraphicsItem *parent = 0
    00845 #ifndef Q_QDOC
    00846                       // ### obsolete argument
    00847                       , QGraphicsScene *scene = 0
    00848 #endif
    00849         );
    00850     QGraphicsLineItem(const QLineF &line, QGraphicsItem *parent = 0
    00851 #ifndef Q_QDOC
    00852                       // ### obsolete argument
    00853                       , QGraphicsScene *scene = 0
    00854 #endif
    00855         );
    00856     QGraphicsLineItem(qreal x1, qreal y1, qreal x2, qreal y2, QGraphicsItem *parent = 0
    00857 #ifndef Q_QDOC
    00858                       // ### obsolete argument
    00859                       , QGraphicsScene *scene = 0
    00860 #endif
    00861         );
    00862     ~QGraphicsLineItem();
    00863
    00864     QPen pen() const;
    00865     void setPen(const QPen &pen);
    00866
    00867     QLineF line() const;
    00868     void setLine(const QLineF &line);
    00869     inline void setLine(qreal x1, qreal y1, qreal x2, qreal y2)
    00870     { setLine(QLineF(x1, y1, x2, y2)); }
    00871
    00872     QRectF boundingRect() const;
    00873     QPainterPath shape() const;
    00874     bool contains(const QPointF &point) const;
    00875
    00876     void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
    00877
    00878     bool isObscuredBy(const QGraphicsItem *item) const;
    00879     QPainterPath opaqueArea() const;
    00880
    00881     enum { Type = 6 };
    00882     int type() const;
    00883
    00884 protected:
    00885     bool supportsExtension(Extension extension) const;
    00886     void setExtension(Extension extension, const QVariant &variant);
    00887     QVariant extension(const QVariant &variant) const;
    00888
    00889 private:
    00890     Q_DISABLE_COPY(QGraphicsLineItem)
    00891     Q_DECLARE_PRIVATE(QGraphicsLineItem)
    00892 };
    00893
    00894 class QGraphicsPixmapItemPrivate;
    00895 class Q_GUI_EXPORT QGraphicsPixmapItem : public QGraphicsItem
    00896 {
    00897 public:
    00898     enum ShapeMode {
    00899         MaskShape,
    00900         BoundingRectShape,
    00901         HeuristicMaskShape
    00902     };
    00903
    00904     QGraphicsPixmapItem(QGraphicsItem *parent = 0
    00905 #ifndef Q_QDOC
    00906                         // ### obsolete argument
    00907                         , QGraphicsScene *scene = 0
    00908 #endif
    00909         );
    00910     QGraphicsPixmapItem(const QPixmap &pixmap, QGraphicsItem *parent = 0
    00911 #ifndef Q_QDOC
    00912                         // ### obsolete argument
    00913                         , QGraphicsScene *scene = 0
    00914 #endif
    00915         );
    00916     ~QGraphicsPixmapItem();
    00917
    00918     QPixmap pixmap() const;
    00919     void setPixmap(const QPixmap &pixmap);
    00920
    00921     Qt::TransformationMode transformationMode() const;
    00922     void setTransformationMode(Qt::TransformationMode mode);
    00923
    00924     QPointF offset() const;
    00925     void setOffset(const QPointF &offset);
    00926     inline void setOffset(qreal x, qreal y);
    00927
    00928     QRectF boundingRect() const;
    00929     QPainterPath shape() const;
    00930     bool contains(const QPointF &point) const;
    00931
    00932     void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
    00933
    00934     bool isObscuredBy(const QGraphicsItem *item) const;
    00935     QPainterPath opaqueArea() const;
    00936
    00937     enum { Type = 7 };
    00938     int type() const;
    00939
    00940     ShapeMode shapeMode() const;
    00941     void setShapeMode(ShapeMode mode);
    00942
    00943 protected:
    00944     bool supportsExtension(Extension extension) const;
    00945     void setExtension(Extension extension, const QVariant &variant);
    00946     QVariant extension(const QVariant &variant) const;
    00947
    00948 private:
    00949     Q_DISABLE_COPY(QGraphicsPixmapItem)
    00950     Q_DECLARE_PRIVATE(QGraphicsPixmapItem)
    00951 };
    00952
    00953 inline void QGraphicsPixmapItem::setOffset(qreal ax, qreal ay)
    00954 { setOffset(QPointF(ax, ay)); }
    00955
    00956 class QGraphicsTextItemPrivate;
    00957 class QTextDocument;
    00958 class QTextCursor;
    00959 class Q_GUI_EXPORT QGraphicsTextItem : public QGraphicsObject
    00960 {
    00961     Q_OBJECT
    00962     QDOC_PROPERTY(bool openExternalLinks READ openExternalLinks WRITE setOpenExternalLinks)
    00963     QDOC_PROPERTY(QTextCursor textCursor READ textCursor WRITE setTextCursor)
    00964
    00965 public:
    00966     QGraphicsTextItem(QGraphicsItem *parent = 0
    00967 #ifndef Q_QDOC
    00968                       // ### obsolete argument
    00969                       , QGraphicsScene *scene = 0
    00970 #endif
    00971         );
    00972     QGraphicsTextItem(const QString &text, QGraphicsItem *parent = 0
    00973 #ifndef Q_QDOC
    00974                       // ### obsolete argument
    00975                       , QGraphicsScene *scene = 0
    00976 #endif
    00977         );
    00978     ~QGraphicsTextItem();
    00979
    00980     QString toHtml() const;
    00981     void setHtml(const QString &html);
    00982
    00983     QString toPlainText() const;
    00984     void setPlainText(const QString &text);
    00985
    00986     QFont font() const;
    00987     void setFont(const QFont &font);
    00988
    00989     void setDefaultTextColor(const QColor &c);
    00990     QColor defaultTextColor() const;
    00991
    00992     QRectF boundingRect() const;
    00993     QPainterPath shape() const;
    00994     bool contains(const QPointF &point) const;
    00995
    00996     void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
    00997
    00998     bool isObscuredBy(const QGraphicsItem *item) const;
    00999     QPainterPath opaqueArea() const;
    01000
    01001     enum { Type = 8 };
    01002     int type() const;
    01003
    01004     void setTextWidth(qreal width);
    01005     qreal textWidth() const;
    01006
    01007     void adjustSize();
    01008
    01009     void setDocument(QTextDocument *document);
    01010     QTextDocument *document() const;
    01011
    01012     void setTextInteractionFlags(Qt::TextInteractionFlags flags);
    01013     Qt::TextInteractionFlags textInteractionFlags() const;
    01014
    01015     void setTabChangesFocus(bool b);
    01016     bool tabChangesFocus() const;
    01017
    01018     void setOpenExternalLinks(bool open);
    01019     bool openExternalLinks() const;
    01020
    01021     void setTextCursor(const QTextCursor &cursor);
    01022     QTextCursor textCursor() const;
    01023
    01024 Q_SIGNALS:
    01025     void linkActivated(const QString &);
    01026     void linkHovered(const QString &);
    01027
    01028 protected:
    01029     bool sceneEvent(QEvent *event);
    01030     void mousePressEvent(QGraphicsSceneMouseEvent *event);
    01031     void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
    01032     void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
    01033     void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
    01034     void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
    01035     void keyPressEvent(QKeyEvent *event);
    01036     void keyReleaseEvent(QKeyEvent *event);
    01037     void focusInEvent(QFocusEvent *event);
    01038     void focusOutEvent(QFocusEvent *event);
    01039     void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
    01040     void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
    01041     void dragMoveEvent(QGraphicsSceneDragDropEvent *event);
    01042     void dropEvent(QGraphicsSceneDragDropEvent *event);
    01043     void inputMethodEvent(QInputMethodEvent *event);
    01044     void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
    01045     void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
    01046     void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
    01047
    01048     QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
    01049
    01050     bool supportsExtension(Extension extension) const;
    01051     void setExtension(Extension extension, const QVariant &variant);
    01052     QVariant extension(const QVariant &variant) const;
    01053
    01054 private:
    01055     Q_DISABLE_COPY(QGraphicsTextItem)
    01056     Q_PRIVATE_SLOT(dd, void _q_updateBoundingRect(const QSizeF &))
    01057     Q_PRIVATE_SLOT(dd, void _q_update(QRectF))
    01058     Q_PRIVATE_SLOT(dd, void _q_ensureVisible(QRectF))
    01059     QGraphicsTextItemPrivate *dd;
    01060     friend class QGraphicsTextItemPrivate;
    01061 };
    01062
    01063 class QGraphicsSimpleTextItemPrivate;
    01064 class Q_GUI_EXPORT QGraphicsSimpleTextItem : public QAbstractGraphicsShapeItem
    01065 {
    01066 public:
    01067     QGraphicsSimpleTextItem(QGraphicsItem *parent = 0
    01068 #ifndef Q_QDOC
    01069                             // ### obsolete argument
    01070                             , QGraphicsScene *scene = 0
    01071 #endif
    01072         );
    01073     QGraphicsSimpleTextItem(const QString &text, QGraphicsItem *parent = 0
    01074 #ifndef Q_QDOC
    01075                             // ### obsolete argument
    01076                             , QGraphicsScene *scene = 0
    01077 #endif
    01078         );
    01079     ~QGraphicsSimpleTextItem();
    01080
    01081     void setText(const QString &text);
    01082     QString text() const;
    01083
    01084     void setFont(const QFont &font);
    01085     QFont font() const;
    01086
    01087     QRectF boundingRect() const;
    01088     QPainterPath shape() const;
    01089     bool contains(const QPointF &point) const;
    01090
    01091     void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
    01092
    01093     bool isObscuredBy(const QGraphicsItem *item) const;
    01094     QPainterPath opaqueArea() const;
    01095
    01096     enum { Type = 9 };
    01097     int type() const;
    01098
    01099 protected:
    01100     bool supportsExtension(Extension extension) const;
    01101     void setExtension(Extension extension, const QVariant &variant);
    01102     QVariant extension(const QVariant &variant) const;
    01103
    01104 private:
    01105     Q_DISABLE_COPY(QGraphicsSimpleTextItem)
    01106     Q_DECLARE_PRIVATE(QGraphicsSimpleTextItem)
    01107 };
    01108
    01109 class QGraphicsItemGroupPrivate;
    01110 class Q_GUI_EXPORT QGraphicsItemGroup : public QGraphicsItem
    01111 {
    01112 public:
    01113     QGraphicsItemGroup(QGraphicsItem *parent = 0
    01114 #ifndef Q_QDOC
    01115                        // ### obsolete argument
    01116                        , QGraphicsScene *scene = 0
    01117 #endif
    01118         );
    01119     ~QGraphicsItemGroup();
    01120
    01121     void addToGroup(QGraphicsItem *item);
    01122     void removeFromGroup(QGraphicsItem *item);
    01123
    01124     QRectF boundingRect() const;
    01125     void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
    01126
    01127     bool isObscuredBy(const QGraphicsItem *item) const;
    01128     QPainterPath opaqueArea() const;
    01129
    01130     enum { Type = 10 };
    01131     int type() const;
    01132
    01133 private:
    01134     Q_DISABLE_COPY(QGraphicsItemGroup)
    01135     Q_DECLARE_PRIVATE(QGraphicsItemGroup)
    01136 };
    01137
    01138 template <class T> inline T qgraphicsitem_cast(QGraphicsItem *item)
    01139 {
    01140     return int(static_cast<T>(0)->Type) == int(QGraphicsItem::Type)
    01141         || (item && int(static_cast<T>(0)->Type) == item->type()) ? static_cast<T>(item) : 0;
    01142 }
    01143
    01144 template <class T> inline T qgraphicsitem_cast(const QGraphicsItem *item)
    01145 {
    01146     return int(static_cast<T>(0)->Type) == int(QGraphicsItem::Type)
    01147         || (item && int(static_cast<T>(0)->Type) == item->type()) ? static_cast<T>(item) : 0;
    01148 }
    01149
    01150 #ifndef QT_NO_DEBUG_STREAM
    01151 Q_GUI_EXPORT QDebug operator<<(QDebug debug, QGraphicsItem *item);
    01152 Q_GUI_EXPORT QDebug operator<<(QDebug debug, QGraphicsObject *item);
    01153 Q_GUI_EXPORT QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemChange change);
    01154 Q_GUI_EXPORT QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemFlag flag);
    01155 Q_GUI_EXPORT QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemFlags flags);
    01156 #endif
    01157
    01158 QT_END_NAMESPACE
    01159
    01160 Q_DECLARE_METATYPE(QGraphicsItem *)
    01161 Q_DECLARE_METATYPE(QGraphicsScene *)
    01162
    01163 QT_BEGIN_NAMESPACE
    01164
    01165 #endif // QT_NO_GRAPHICSVIEW
    01166
    01167 QT_END_NAMESPACE
    01168
    01169 QT_END_HEADER
    01170
    01171 #endif // QGRAPHICSITEM_H