GraphView.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015-2016 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
18 #ifndef _GAZEBO_GRAPH_VIEW_HH_
19 #define _GAZEBO_GRAPH_VIEW_HH_
20 
21 #include "gazebo/gui/qt.h"
22 
23 namespace gazebo
24 {
25  namespace gui
26  {
29  class GraphView : public QGraphicsView
30  {
31  Q_OBJECT
32 
35  public: GraphView(QWidget *_parent = 0);
36 
38  public: virtual ~GraphView() = default;
39 
42  private: void resizeEvent(QResizeEvent *_event);
43 
47  private: void scrollContentsBy(int _dx, int _dy);
48 
51  private: void contextMenuEvent(QContextMenuEvent *_event);
52 
55  private: void wheelEvent(QWheelEvent *_event);
56 
59  private: void mouseMoveEvent(QMouseEvent *_event);
60 
63  private: void mousePressEvent(QMouseEvent *_event);
64 
67  private: void mouseReleaseEvent(QMouseEvent *_event);
68 
71  private: void mouseDoubleClickEvent(QMouseEvent *_event);
72 
75  private: void keyPressEvent(QKeyEvent *_event);
76 
79  Q_SIGNALS: void customContextMenuRequested(QString _id);
80 
83  Q_SIGNALS: void itemDoubleClicked(QString _id);
84 
86  public: QGraphicsItem *lastClickedItem = nullptr;
87 
89  private: double viewScale;
90  };
91  }
92 }
93 
94 #endif
Forward declarations for the common classes.
Definition: Animation.hh:33
void customContextMenuRequested(QString _id)
Qt signal emitted when a context menu event is triggered.
A view for the graph scene.
Definition: GraphView.hh:29
GraphView(QWidget *_parent=0)
Constructor.
QGraphicsItem * lastClickedItem
Store which item was clicked last.
Definition: GraphView.hh:86
void itemDoubleClicked(QString _id)
Qt signal emitted when an item is double clicked.
virtual ~GraphView()=default
Destructor.