Loading...
Searching...
No Matches
QGVSubGraph.h
Go to the documentation of this file.
1/***************************************************************
2QGVCore
3Copyright (c) 2014, Bergont Nicolas, All rights reserved.
4
5This library is free software; you can redistribute it and/or
6modify it under the terms of the GNU Lesser General Public
7License as published by the Free Software Foundation; either
8version 3.0 of the License, or (at your option) any later version.
9
10This library is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13Lesser General Public License for more details.
14
15You should have received a copy of the GNU Lesser General Public
16License along with this library.
17***************************************************************/
18#ifndef QGVSUBGRAPH_H
19#define QGVSUBGRAPH_H
20
21#include <QGraphicsItem>
22#include <QPen>
23
24#include "qgv.h"
25
26class QGVNode;
27class QGVEdge;
28class QGVScene;
29class QGVGraphPrivate;
30
35class QGVCORE_EXPORT QGVSubGraph : public QGraphicsItem {
36 public:
38
39 QString name() const;
40
41 QGVNode *addNode(const QString &label);
42 QGVSubGraph *addSubGraph(const QString &name, bool cluster = true);
43
44 QRectF boundingRect() const;
45 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
46 QWidget *widget = 0);
47 void setAttribute(const QString &name, const QString &value);
48 QString getAttribute(const QString &name) const;
49 void updateLayout();
50
51 enum { Type = UserType + 4 };
52 int type() const { return Type; }
53
54 private:
55 friend class QGVScene;
56 QGVSubGraph(QGVGraphPrivate *subGraph, QGVScene *scene);
57
58 double _height, _width;
59 QPen _pen;
60 QBrush _brush;
61
62 QString _label;
63 QRectF _label_rect;
64
65 QGVScene *_scene;
66 QGVGraphPrivate *_sgraph;
67 QList<QGVNode *> _nodes;
68};
69
70#endif // QGVSUBGRAPH_H
Edge item.
Definition: QGVEdge.h:34
Definition: QGVGraphPrivate.h:6
Node item.
Definition: QGVNode.h:34
GraphViz interactive scene.
Definition: QGVScene.h:36
SubGraph item.
Definition: QGVSubGraph.h:35
int type() const
Definition: QGVSubGraph.h:52
#define QGVCORE_EXPORT
Definition: qgv.h:9