GraphView.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 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 #ifndef GAZEBO_GUI_MODEL_GRAPHVIEW_HH_
18 #define GAZEBO_GUI_MODEL_GRAPHVIEW_HH_
19 
20 #include "gazebo/gui/qt.h"
21 
22 namespace gazebo
23 {
24  namespace gui
25  {
28  class GraphView : public QGraphicsView
29  {
30  Q_OBJECT
31 
34  public: explicit GraphView(QWidget *_parent = 0);
35 
37  public: virtual ~GraphView() = default;
38 
41  private: void resizeEvent(QResizeEvent *_event);
42 
46  private: void scrollContentsBy(int _dx, int _dy);
47 
50  private: void contextMenuEvent(QContextMenuEvent *_event);
51 
54  private: void wheelEvent(QWheelEvent *_event);
55 
58  private: void mouseMoveEvent(QMouseEvent *_event);
59 
62  private: void mousePressEvent(QMouseEvent *_event);
63 
66  private: void mouseReleaseEvent(QMouseEvent *_event);
67 
70  private: void mouseDoubleClickEvent(QMouseEvent *_event);
71 
74  private: void keyPressEvent(QKeyEvent *_event);
75 
78  Q_SIGNALS: void customContextMenuRequested(QString _id);
79 
82  Q_SIGNALS: void itemDoubleClicked(QString _id);
83 
85  public: QGraphicsItem *lastClickedItem = nullptr;
86 
88  private: double viewScale;
89  };
90  }
91 }
92 
93 #endif
void customContextMenuRequested(QString _id)
Qt signal emitted when a context menu event is triggered.
A view for the graph scene.
Definition: GraphView.hh:28
GraphView(QWidget *_parent=0)
Constructor.
QGraphicsItem * lastClickedItem
Store which item was clicked last.
Definition: GraphView.hh:85
void itemDoubleClicked(QString _id)
Qt signal emitted when an item is double clicked.
virtual ~GraphView()=default
Destructor.