diff options
author | Alexis Menard <alexis.menard@nokia.com> | 2009-06-16 08:34:44 (GMT) |
---|---|---|
committer | Alexis Menard <alexis.menard@nokia.com> | 2009-06-16 08:34:44 (GMT) |
commit | fec52b0c12386cbd3fd7d8cb886afaef5e30a744 (patch) | |
tree | 01fa9a01f880e04f74d067e579d165904d02b11f /src/gui/graphicsview/qgraphicsitem.h | |
parent | 3dce31e5eb0fac43d445fb9664f1b68f4cd4c11f (diff) | |
parent | ea83669b9b44b1fb3a5acae6d53afd1df401e9b5 (diff) | |
download | Qt-fec52b0c12386cbd3fd7d8cb886afaef5e30a744.zip Qt-fec52b0c12386cbd3fd7d8cb886afaef5e30a744.tar.gz Qt-fec52b0c12386cbd3fd7d8cb886afaef5e30a744.tar.bz2 |
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt into qt-main/qgraphicssceneindex
Conflicts:
src/gui/graphicsview/graphicsview.pri
src/gui/graphicsview/qgraphicsitem.cpp
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 3b1e403..6194249 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); @@ -223,7 +228,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); @@ -490,6 +497,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 { @@ -841,7 +881,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) |