Line |
Branch |
Exec |
Source |
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 <QGraphicsItem> |
22 |
|
|
#include <QPen> |
23 |
|
|
|
24 |
|
|
#include "qgv.h" |
25 |
|
|
|
26 |
|
|
class QGVNode; |
27 |
|
|
class QGVEdge; |
28 |
|
|
class QGVScene; |
29 |
|
|
class QGVGraphPrivate; |
30 |
|
|
|
31 |
|
|
/** |
32 |
|
|
* @brief SubGraph item |
33 |
|
|
* |
34 |
|
|
*/ |
35 |
|
|
class QGVCORE_EXPORT QGVSubGraph : public QGraphicsItem { |
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, |
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 |
71 |
|
|
|