31 #include <graphviz/gvc.h>
34 #include <QGraphicsView>
35 #include <QGraphicsScene>
36 #include <QGraphicsPathItem>
38 #include <QContextMenuEvent>
39 #include <QMouseEvent>
52 QY2Graph(
const std::string& filename,
const std::string& layoutAlgorithm, QWidget* parent = 0);
54 QY2Graph(graph_t* graph, QWidget* parent = 0);
58 virtual void renderGraph(
const std::string& filename,
const std::string& layoutAlgorithm);
59 virtual void renderGraph(graph_t* graph);
65 void backgroundContextMenuEvent(QContextMenuEvent* event);
66 void nodeContextMenuEvent(QContextMenuEvent* event,
const QString& name);
67 void nodeDoubleClickEvent(QMouseEvent* event,
const QString& name);
71 void keyPressEvent(QKeyEvent* event);
72 void wheelEvent(QWheelEvent* event);
73 void contextMenuEvent(QContextMenuEvent* event);
74 void mouseDoubleClickEvent(QMouseEvent* event);
80 void scaleView(qreal scaleFactor);
82 QGraphicsScene* scene;
86 QPointF gToQ(
const pointf& p,
bool upside_down =
true)
const;
88 QString aggetToQString(
void* obj,
const char* name,
const QString& fallback)
const;
89 QColor aggetToQColor(
void* obj,
const char* name,
const QColor& fallback)
const;
90 Qt::PenStyle aggetToQPenStyle(
void* obj,
const char* name,
const Qt::PenStyle fallback)
const;
92 QPainterPath makeShape(node_t* node)
const;
93 QPolygonF makeShapeHelper(node_t* node)
const;
95 QPainterPath makeBezier(
const bezier& bezier)
const;
97 void drawLabel(
const textlabel_t* textlabel, QPainter* painter)
const;
99 void drawArrow(
const QLineF& line,
const QColor& color, QPainter* painter)
const;
104 class QY2Node :
public QObject,
public QGraphicsPathItem
110 QY2Node(
const QPainterPath& path,
const QPicture& picture,
const QString& name);
112 void paint(QPainter* painter,
const QStyleOptionGraphicsItem* option, QWidget* widget);
130 QY2Edge(
const QPainterPath& path,
const QPicture& picture);
132 QRectF boundingRect()
const;
134 void paint(QPainter* painter,
const QStyleOptionGraphicsItem* option, QWidget* widget);