hpp-plot  4.12.0
Plotting tools for HPP
graph-widget.hh
Go to the documentation of this file.
1 // BSD 2-Clause License
2 
3 // Copyright (c) 2015 - 2018, hpp-plot
4 // Authors: Heidy Dallard, Joseph Mirabel
5 // All rights reserved.
6 
7 // Redistribution and use in source and binary forms, with or without
8 // modification, are permitted provided that the following conditions
9 // are met:
10 
11 // * Redistributions of source code must retain the above copyright
12 // notice, this list of conditions and the following disclaimer.
13 
14 // * Redistributions in binary form must reproduce the above copyright
15 // notice, this list of conditions and the following disclaimer in
16 // the documentation and/or other materials provided with the
17 // distribution.
18 
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22 // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23 // COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28 // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
30 // OF THE POSSIBILITY OF SUCH DAMAGE.
31 
32 #ifndef HPP_PLOT_GRAPHWIDGET_HH
33 #define HPP_PLOT_GRAPHWIDGET_HH
34 
35 #include <QWidget>
36 #include <QGraphicsScene>
37 #include <QGraphicsView>
38 #include <QComboBox>
39 #include <QTextEdit>
40 
41 #include <QGVScene.h>
42 
43 namespace hpp {
44  namespace plot {
45  class GraphView : public QGraphicsView
46  {
47  public:
48  GraphView (QWidget* parent = NULL);
49 
50  // QWidget interface
51  protected:
52  void wheelEvent(QWheelEvent *);
53  };
54 
55  class GraphWidget : public QWidget
56  {
57  Q_OBJECT
58 
59  public:
60  GraphWidget (QString name = QString (), QWidget *parent = NULL);
61 
62  ~GraphWidget ();
63 
64  public slots:
65  void updateGraph ();
66  void updateEdges ();
67  void saveDotFile ();
68 
69  protected slots:
70  virtual void nodeContextMenu(QGVNode* node);
71  virtual void nodeDoubleClick(QGVNode* node);
72  virtual void edgeContextMenu(QGVEdge* edge);
73  virtual void edgeDoubleClick(QGVEdge* edge);
74 
75  protected:
76  virtual void fillScene ();
77  QGVScene* scene_;
78  QWidget* buttonBox_;
79  QTextEdit* elmtInfo_;
80  QTextEdit* loggingInfo_;
81  QTextEdit* constraintInfo_;
82 
83  private:
84  GraphView* view_;
85  QComboBox* algList_;
86  bool layoutShouldBeFreed_;
87  };
88  }
89 }
90 
91 #endif // HPP_PLOT_GRAPHWIDGET_HH
Definition: graph-widget.hh:46
void wheelEvent(QWheelEvent *)
Definition: graph-widget.cc:62
GraphView(QWidget *parent=NULL)
Definition: graph-widget.cc:54
Definition: graph-widget.hh:56
virtual void edgeContextMenu(QGVEdge *edge)
Definition: graph-widget.cc:209
QWidget * buttonBox_
Definition: graph-widget.hh:78
QTextEdit * elmtInfo_
Definition: graph-widget.hh:79
GraphWidget(QString name=QString(), QWidget *parent=NULL)
Definition: graph-widget.cc:72
QGVScene * scene_
Definition: graph-widget.hh:77
virtual void nodeDoubleClick(QGVNode *node)
Definition: graph-widget.cc:199
void updateGraph()
Definition: graph-widget.cc:152
virtual void fillScene()
Definition: graph-widget.cc:214
~GraphWidget()
Definition: graph-widget.cc:147
QTextEdit * constraintInfo_
Definition: graph-widget.hh:81
QTextEdit * loggingInfo_
Definition: graph-widget.hh:80
virtual void nodeContextMenu(QGVNode *node)
Definition: graph-widget.cc:194
void saveDotFile()
Definition: graph-widget.cc:185
void updateEdges()
Definition: graph-widget.cc:177
virtual void edgeDoubleClick(QGVEdge *edge)
Definition: graph-widget.cc:204
Definition: graph-widget.hh:43