summaryrefslogtreecommitdiffstats
path: root/examples/animation/stickman/node.h
diff options
context:
space:
mode:
Diffstat (limited to 'examples/animation/stickman/node.h')
-rw-r--r--examples/animation/stickman/node.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/examples/animation/stickman/node.h b/examples/animation/stickman/node.h
new file mode 100644
index 0000000..e9e9190
--- /dev/null
+++ b/examples/animation/stickman/node.h
@@ -0,0 +1,31 @@
+#ifndef NODE_H
+#define NODE_H
+
+#include <QGraphicsItem>
+
+class Node: public QObject, public QGraphicsItem
+{
+ Q_OBJECT
+ Q_PROPERTY(QPointF position READ pos WRITE setPos);
+public:
+ Node(const QPointF &pos, QGraphicsItem *parent = 0);
+ ~Node();
+
+ QRectF boundingRect() const;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
+
+signals:
+ void positionChanged();
+
+protected:
+ QVariant itemChange(GraphicsItemChange change, const QVariant &value);
+
+ void mousePressEvent(QGraphicsSceneMouseEvent *);
+ void mouseMoveEvent(QGraphicsSceneMouseEvent *);
+ void mouseReleaseEvent(QGraphicsSceneMouseEvent *);
+
+private:
+ bool m_dragging;
+};
+
+#endif