diff options
Diffstat (limited to 'src/gui/graphicsview/qgraphicsitem.h')
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem.h | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index 69aab20..a5ccef2 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; @@ -159,6 +160,9 @@ public: bool isWidget() const; bool isWindow() const; + QGraphicsObject *toGraphicsObject(); + const QGraphicsObject *toGraphicsObject() const; + QGraphicsItemGroup *group() const; void setGroup(QGraphicsItemGroup *group); @@ -484,6 +488,31 @@ 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_INTERFACES(QGraphicsItem) + Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged) + Q_PROPERTY(QPointF pos READ pos WRITE setPos NOTIFY positionChanged) + Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged) + Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged) +public: + QGraphicsObject(QGraphicsItem *parent = 0); + +Q_SIGNALS: + void opacityChanged(); + void visibleChanged(); + void enabledChanged(); + void positionChanged(); + +protected: + QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent, QGraphicsScene *scene); +private: + friend class QGraphicsItem; +}; + + class QAbstractGraphicsShapeItemPrivate; class Q_GUI_EXPORT QAbstractGraphicsShapeItem : public QGraphicsItem { @@ -832,20 +861,6 @@ private: inline void QGraphicsPixmapItem::setOffset(qreal ax, qreal ay) { setOffset(QPointF(ax, ay)); } -class Q_GUI_EXPORT QGraphicsObject : public QObject, public QGraphicsItem -{ - Q_OBJECT - Q_INTERFACES(QGraphicsItem) - Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity) - Q_PROPERTY(QPointF pos READ pos WRITE setPos) - Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled) - Q_PROPERTY(bool visible READ isVisible WRITE setVisible) -public: - QGraphicsObject(QGraphicsItem *parent = 0); -protected: - QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent, QGraphicsScene *scene); -}; - class QGraphicsTextItemPrivate; class QTextDocument; class QTextCursor; |