5 * th9x - http://code.google.com/p/th9x
6 * er9x - http://code.google.com/p/er9x
7 * gruvin9x - http://code.google.com/p/gruvin9x
9 * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
26 #define DEFAULT_BALL_SIZE 10
27 #define DEFAULT_BALL_HEIGHT 2
31 class QGraphicsSceneMouseEvent
;
34 class Node
: public QGraphicsObject
41 void addEdge(Edge
*edge
);
42 QList
<Edge
*> edges() const;
44 enum { Type
= UserType
+ 1 };
45 int type() const { return Type
; }
46 QRectF
boundingRect() const;
47 QPainterPath
shape() const;
48 void paint(QPainter
*painter
, const QStyleOptionGraphicsItem
*option
, QWidget
*widget
);
49 void setBallSize(int size
);
50 void stepToCenter(qreal step
=10);
51 int getBallSize() { return ballSize
; }
54 void setX(qreal newX
);
55 void setY(qreal newX
);
57 void setCenteringX(bool val
) { centerX
= val
; }
58 void setCenteringY(bool val
) { centerY
= val
; }
59 void setFixedX(bool val
) { fixedX
= val
; }
60 void setFixedY(bool val
) { fixedY
= val
; }
61 bool getFixedX() { return fixedX
; }
62 bool getFixedY() { return fixedY
; }
63 void setMinX(int val
) { minX
= val
; }
64 void setMaxX(int val
) { maxX
= val
; }
65 void setPressed(bool pressed
) { bPressed
= pressed
; }
66 bool isPressed() const { return bPressed
; }
67 void setColor(const QColor
& color
);
68 void setBallHeight(int height
);
69 int geBallHeight() { return ballHeight
; }
72 void moved(int x
, int y
);
78 QVariant
itemChange(GraphicsItemChange change
, const QVariant
&value
);
79 void mousePressEvent(QGraphicsSceneMouseEvent
*event
);
80 void mouseReleaseEvent(QGraphicsSceneMouseEvent
*event
);
91 QList
<Edge
*> edgeList
;