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 #ifndef QGVSUBGRAPH_H
19 #define QGVSUBGRAPH_H
20 
21 #include "qgv.h"
22 #include <QGraphicsItem>
23 #include <QPen>
24 
25 class QGVNode;
26 class QGVEdge;
27 class QGVScene;
28 class QGVGraphPrivate;
29 
34 class QGVCORE_EXPORT QGVSubGraph : public QGraphicsItem
35 {
36 public:
37  ~QGVSubGraph();
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, QWidget * widget = 0);
46  void setAttribute(const QString &name, const QString &value);
47  QString getAttribute(const QString &name) const;
48  void updateLayout();
49 
50  enum { Type = UserType + 4 };
51  int type() const
52  {
53  return Type;
54  }
55 
56 
57 private:
58  friend class QGVScene;
59  QGVSubGraph(QGVGraphPrivate* subGraph, QGVScene *scene);
60 
61  double _height, _width;
62  QPen _pen;
63  QBrush _brush;
64 
65  QString _label;
66  QRectF _label_rect;
67 
68  QGVScene *_scene;
69  QGVGraphPrivate *_sgraph;
70  QList<QGVNode*> _nodes;
71 };
72 
73 #endif // QGVSUBGRAPH_H
friend class QGVSubGraph
Definition: QGVScene.h:89
Node item.
Definition: QGVNode.h:33
Definition: QGVGraphPrivate.h:6
Edge item.
Definition: QGVEdge.h:33
SubGraph item.
Definition: QGVSubGraph.h:34
int type() const
Definition: QGVSubGraph.h:51
GraphViz interactive scene.
Definition: QGVScene.h:35
#define QGVCORE_EXPORT
Definition: qgv.h:9