You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
#ifndef NODE_H
|
|
|
|
#define NODE_H
|
|
|
|
|
|
|
|
#include <QGraphicsTextItem>
|
|
|
|
|
|
|
|
#include "edge.h"
|
|
|
|
#include "graphwidget.h"
|
|
|
|
|
|
|
|
class GraphWidget;
|
|
|
|
|
|
|
|
/// @bug no signal when size change
|
|
|
|
class Node : public QGraphicsTextItem
|
|
|
|
{
|
|
|
|
// Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
Node(GraphWidget *graphWidget = 0);
|
|
|
|
|
|
|
|
void addEdge(Edge *edge);
|
|
|
|
QList<Edge *> edges() const;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
|
|
|
|
void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
|
|
|
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
|
|
|
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
QList<Edge *> edgeList;
|
|
|
|
GraphWidget *graph;
|
|
|
|
bool active;
|
|
|
|
QRectF m_rect;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // NODE_H
|