diff options
author | Jan-Arve Sæther <jan-arve.saether@nokia.com> | 2010-04-29 07:35:23 (GMT) |
---|---|---|
committer | Jan-Arve Sæther <jan-arve.saether@nokia.com> | 2010-04-29 07:35:23 (GMT) |
commit | 71165896c2867091abe6df98ea18ac0536028a0b (patch) | |
tree | 91e7b1efa84eae456ae3d9b4831f0a0ce7f8bedc /examples/graphicsview/dragdroprobot/robot.h | |
parent | e24b4b83fa4e71ab137ac254a9c69fec672d5e66 (diff) | |
parent | 1f5e2724e788e53ede53a7e9ee4e08f4ad3ccc51 (diff) | |
download | Qt-71165896c2867091abe6df98ea18ac0536028a0b.zip Qt-71165896c2867091abe6df98ea18ac0536028a0b.tar.gz Qt-71165896c2867091abe6df98ea18ac0536028a0b.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7
Diffstat (limited to 'examples/graphicsview/dragdroprobot/robot.h')
-rw-r--r-- | examples/graphicsview/dragdroprobot/robot.h | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/examples/graphicsview/dragdroprobot/robot.h b/examples/graphicsview/dragdroprobot/robot.h index 88c4364..f5ff32c 100644 --- a/examples/graphicsview/dragdroprobot/robot.h +++ b/examples/graphicsview/dragdroprobot/robot.h @@ -46,10 +46,11 @@ QT_BEGIN_NAMESPACE class QGraphicsSceneMouseEvent; -class QTimeLine; +class QParallelAnimationGroup; QT_END_NAMESPACE -class RobotPart : public QGraphicsItem +//! [0] +class RobotPart : public QGraphicsObject { public: RobotPart(QGraphicsItem *parent = 0); @@ -59,11 +60,12 @@ protected: void dragLeaveEvent(QGraphicsSceneDragDropEvent *event); void dropEvent(QGraphicsSceneDragDropEvent *event); - QPixmap pixmap; QColor color; bool dragOver; }; +//! [0] +//! [1] class RobotHead : public RobotPart { public: @@ -72,10 +74,16 @@ public: QRectF boundingRect() const; void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); - enum { Type = UserType + 1 }; - int type() const; +protected: + void dragEnterEvent(QGraphicsSceneDragDropEvent *event); + void dropEvent(QGraphicsSceneDragDropEvent *event); + +private: + QPixmap pixmap; }; +//! [1] +//! [2] class RobotTorso : public RobotPart { public: @@ -84,7 +92,9 @@ public: QRectF boundingRect() const; void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); }; +//! [2] +//! [3] class RobotLimb : public RobotPart { public: @@ -93,18 +103,17 @@ public: QRectF boundingRect() const; void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); }; +//! [3] +//! [4] class Robot : public RobotPart { public: - Robot(); - ~Robot(); + Robot(QGraphicsItem *parent = 0); QRectF boundingRect() const; void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); - -private: - QTimeLine *timeLine; }; +//! [4] #endif |