summaryrefslogtreecommitdiffstats
path: root/examples/graphicsview/dragdroprobot/robot.h
diff options
context:
space:
mode:
authorAndreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com>2010-04-26 13:35:10 (GMT)
committerAndreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com>2010-04-29 06:59:42 (GMT)
commit5506677d71341f5bfe31db0cfb31b2e7a36c1846 (patch)
tree0b4df83711064374df0f9143945912a515193a3a /examples/graphicsview/dragdroprobot/robot.h
parent3eded761167af317bab4f4d8c1ac0a12433eb03a (diff)
downloadQt-5506677d71341f5bfe31db0cfb31b2e7a36c1846.zip
Qt-5506677d71341f5bfe31db0cfb31b2e7a36c1846.tar.gz
Qt-5506677d71341f5bfe31db0cfb31b2e7a36c1846.tar.bz2
Documentation for the Drag and Drop Robot example.
Checked that it doesn't introduce qdoc errors. Discussed with David and Martin; recommendation was to commit first and fix any errors via review in later commits.
Diffstat (limited to 'examples/graphicsview/dragdroprobot/robot.h')
-rw-r--r--examples/graphicsview/dragdroprobot/robot.h29
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