GraphTool  1.0
Tool for analyzing and graphically visualizing code dependencies for Ericsson.
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
graph_view.h
1 
8 #ifndef GUI_GRAPH_VIEW_H_
9 #define GUI_GRAPH_VIEW_H_
10 
11 // Qt-imports
12 #include <QGraphicsView>
13 #include <QWidget>
14 #include <QWheelEvent>
15 #include <QAction>
16 #include <QMenu>
17 #include <QDebug>
18 #include <QWhatsThis>
19 #include <QRubberBand>
20 
21 // General imports
22 #include <cmath>
23 #include "qmath.h"
24 #include <typeinfo>
25 
26 // Local imports
27 #include "graph_scene.h"
28 #include "node_widget.h"
29 
30 class GraphView : public QGraphicsView {
31  Q_OBJECT
32 
33  public:
34 
39  GraphView(QWidget* parent = 0);
40 
46  GraphView(GraphScene* scene, QWidget* parent = 0);
47 
52  void set_zoom_level(uint value);
53 
57  void reset_prev_marked();
58 
63  std::vector<NodeWidget*> get_prev_marked();
64 
68  QRectF visibleRect();
69 
70  void fitInView(QRectF scene, Qt::AspectRatioMode aspectRatio);
71  protected:
75  void resizeEvent(QResizeEvent*);
76  private:
77 
79  QPointF mousePos;
80 
82  std::vector<NodeWidget*> prev_marked_nodes;
83 
85  QSlider* zoom_slider_;
86 
88  int previous_value_;
89 
91  QRubberBand* rubberBand;
92 
94  QPoint rubberBandOrigin;
95 
96 
97  protected:
98 
102  void setupView();
103 
108  void wheelEvent(QWheelEvent* event);
109 
114  void mousePressEvent( QMouseEvent* event);
115 
120  void mouseDoubleClickEvent( QMouseEvent* event );
121 
125  void mouseMoveEvent(QMouseEvent *event);
126 
130  void mouseReleaseEvent(QMouseEvent *event);
131 
132  public slots:
133 
138  void zoomIn(int level = 1);
139 
144  void zoomOut(int level = 1);
145 
151  void onCustomContextMenu(const QPoint &point);
152 
153  private slots:
154 
158  void scaleView(int);
159 
160 
161  signals:
162 
168  void itemDoubleClicked(QGraphicsItem* item);
169 
175  void itemCtrlClicked(QGraphicsItem* item);
176 
184  void right_click_menu(const QPoint &point, std::string name);
185 
193  void item_selected_in_graph(std::string name, bool first);
194 };
195 
196 #endif
void resizeEvent(QResizeEvent *)
Definition: graph_view.cc:209
void zoomIn(int level=1)
Definition: graph_view.cc:78
std::vector< NodeWidget * > get_prev_marked()
Definition: graph_view.cc:198
void mouseMoveEvent(QMouseEvent *event)
Definition: graph_view.cc:136
void reset_prev_marked()
Definition: graph_view.cc:186
void itemDoubleClicked(QGraphicsItem *item)
QRectF visibleRect()
Definition: graph_view.cc:203
void mouseDoubleClickEvent(QMouseEvent *event)
Definition: graph_view.cc:167
void wheelEvent(QWheelEvent *event)
Definition: graph_view.cc:46
void set_zoom_level(uint value)
Definition: graph_view.cc:88
Definition: graph_scene.h:24
Definition: graph_view.h:30
void onCustomContextMenu(const QPoint &point)
Definition: graph_view.cc:177
void mouseReleaseEvent(QMouseEvent *event)
Definition: graph_view.cc:144
GraphView(QWidget *parent=0)
Definition: graph_view.cc:3
void itemCtrlClicked(QGraphicsItem *item)
void item_selected_in_graph(std::string name, bool first)
void right_click_menu(const QPoint &point, std::string name)
void zoomOut(int level=1)
Definition: graph_view.cc:83
void setupView()
Definition: graph_view.cc:13
void mousePressEvent(QMouseEvent *event)
Definition: graph_view.cc:93