hpp-plot  4.15.1
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 <QGVScene.h>
36 
37 #include <QComboBox>
38 #include <QGraphicsScene>
39 #include <QGraphicsView>
40 #include <QTextEdit>
41 #include <QWidget>
42 
43 namespace hpp {
44 namespace plot {
45 class GraphView : public QGraphicsView {
46  public:
47  GraphView(QWidget* parent = NULL);
48 
49  // QWidget interface
50  protected:
51  void wheelEvent(QWheelEvent*);
52 };
53 
54 class GraphWidget : public QWidget {
55  Q_OBJECT
56 
57  public:
58  GraphWidget(QString name = QString(), QWidget* parent = NULL);
59 
60  ~GraphWidget();
61 
62  public slots:
63  void updateGraph();
64  void updateEdges();
65  void saveDotFile();
66 
67  protected slots:
68  virtual void nodeContextMenu(QGVNode* node);
69  virtual void nodeDoubleClick(QGVNode* node);
70  virtual void edgeContextMenu(QGVEdge* edge);
71  virtual void edgeDoubleClick(QGVEdge* edge);
72 
73  protected:
74  virtual void fillScene();
75  QGVScene* scene_;
76  QWidget* buttonBox_;
77  QTextEdit* elmtInfo_;
78  QTextEdit* loggingInfo_;
79  QTextEdit* constraintInfo_;
80 
81  private:
82  GraphView* view_;
83  QComboBox* algList_;
84  bool layoutShouldBeFreed_;
85 };
86 } // namespace plot
87 } // namespace hpp
88 
89 #endif // HPP_PLOT_GRAPHWIDGET_HH
Definition: graph-widget.hh:45
void wheelEvent(QWheelEvent *)
Definition: graph-widget.cc:60
GraphView(QWidget *parent=NULL)
Definition: graph-widget.cc:54
Definition: graph-widget.hh:54
virtual void edgeContextMenu(QGVEdge *edge)
Definition: graph-widget.cc:203
QWidget * buttonBox_
Definition: graph-widget.hh:76
QTextEdit * elmtInfo_
Definition: graph-widget.hh:77
GraphWidget(QString name=QString(), QWidget *parent=NULL)
Definition: graph-widget.cc:72
QGVScene * scene_
Definition: graph-widget.hh:75
virtual void nodeDoubleClick(QGVNode *node)
Definition: graph-widget.cc:199
void updateGraph()
Definition: graph-widget.cc:159
virtual void fillScene()
Definition: graph-widget.cc:205
~GraphWidget()
Definition: graph-widget.cc:157
QTextEdit * constraintInfo_
Definition: graph-widget.hh:79
QTextEdit * loggingInfo_
Definition: graph-widget.hh:78
virtual void nodeContextMenu(QGVNode *node)
Definition: graph-widget.cc:197
void saveDotFile()
Definition: graph-widget.cc:189
void updateEdges()
Definition: graph-widget.cc:182
virtual void edgeDoubleClick(QGVEdge *edge)
Definition: graph-widget.cc:201
Definition: graph-widget.hh:43