diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-06-12 07:47:49 (GMT) |
---|---|---|
committer | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-06-12 07:47:49 (GMT) |
commit | 6ab9ca55342dad0ce16402b7d2f8d47d61a0af76 (patch) | |
tree | 8a022fb07d41cb3d7f3850ae5f68a15ecd8130c5 /src/gui/graphicsview/qgraphicsitem.h | |
parent | 144154046529e557616738c13b3721e3cab77301 (diff) | |
parent | d0baa9b8dc9ed191903447032f1cf6afe9a2463e (diff) | |
download | Qt-6ab9ca55342dad0ce16402b7d2f8d47d61a0af76.zip Qt-6ab9ca55342dad0ce16402b7d2f8d47d61a0af76.tar.gz Qt-6ab9ca55342dad0ce16402b7d2f8d47d61a0af76.tar.bz2 |
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt
Conflicts:
src/gui/graphicsview/qgraphicsitem_p.h
Diffstat (limited to 'src/gui/graphicsview/qgraphicsitem.h')
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem.h | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index 7c46b87..79cbfd9 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -63,6 +63,7 @@ class QBrush; class QCursor; class QFocusEvent; class QGraphicsItemGroup; +class QGraphicsObject; class QGraphicsSceneContextMenuEvent; class QGraphicsSceneDragDropEvent; class QGraphicsSceneEvent; @@ -150,6 +151,7 @@ public: QGraphicsItem *parentItem() const; QGraphicsItem *topLevelItem() const; + QGraphicsObject *parentObject() const; QGraphicsWidget *parentWidget() const; QGraphicsWidget *topLevelWidget() const; QGraphicsWidget *window() const; @@ -159,6 +161,9 @@ public: bool isWidget() const; bool isWindow() const; + QGraphicsObject *toGraphicsObject(); + const QGraphicsObject *toGraphicsObject() const; + QGraphicsItemGroup *group() const; void setGroup(QGraphicsItemGroup *group); @@ -225,7 +230,9 @@ public: // Positioning in scene coordinates QPointF pos() const; inline qreal x() const { return pos().x(); } + void setX(qreal x); inline qreal y() const { return pos().y(); } + void setY(qreal y); QPointF scenePos() const; void setPos(const QPointF &pos); inline void setPos(qreal x, qreal y); @@ -491,6 +498,39 @@ inline QRectF QGraphicsItem::mapRectFromParent(qreal ax, qreal ay, qreal w, qrea inline QRectF QGraphicsItem::mapRectFromScene(qreal ax, qreal ay, qreal w, qreal h) const { return mapRectFromScene(QRectF(ax, ay, w, h)); } + +class Q_GUI_EXPORT QGraphicsObject : public QObject, public QGraphicsItem +{ + Q_OBJECT + Q_PROPERTY(QGraphicsObject * parent READ parentObject WRITE setParentItem NOTIFY parentChanged DESIGNABLE false) + Q_PROPERTY(QString id READ objectName WRITE setObjectName) + Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged) + Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged) + Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged) + Q_PROPERTY(QPointF pos READ pos WRITE setPos) + Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged) + Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged) + Q_PROPERTY(qreal z READ zValue WRITE setZValue NOTIFY zChanged) +public: + QGraphicsObject(QGraphicsItem *parent = 0); + +Q_SIGNALS: + void parentChanged(); + void opacityChanged(); + void visibleChanged(); + void enabledChanged(); + void xChanged(); + void yChanged(); + void zChanged(); + +protected: + QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent, QGraphicsScene *scene); +private: + friend class QGraphicsItem; + friend class QGraphicsItemPrivate; +}; + + class QAbstractGraphicsShapeItemPrivate; class Q_GUI_EXPORT QAbstractGraphicsShapeItem : public QGraphicsItem { @@ -842,7 +882,7 @@ inline void QGraphicsPixmapItem::setOffset(qreal ax, qreal ay) class QGraphicsTextItemPrivate; class QTextDocument; class QTextCursor; -class Q_GUI_EXPORT QGraphicsTextItem : public QObject, public QGraphicsItem +class Q_GUI_EXPORT QGraphicsTextItem : public QGraphicsObject { Q_OBJECT QDOC_PROPERTY(bool openExternalLinks READ openExternalLinks WRITE setOpenExternalLinks) |