summaryrefslogtreecommitdiffstats
path: root/examples/animation/stickman/node.h
blob: b796774d33ad7892d9a5cea3871f9e0c279d88fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#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);

protected:
    void mousePressEvent(QGraphicsSceneMouseEvent *);
    void mouseMoveEvent(QGraphicsSceneMouseEvent *);
    void mouseReleaseEvent(QGraphicsSceneMouseEvent *);

private:
    bool m_dragging;
};

#endif