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