Gazebo Gui

API Reference

3.12.0
gz/gui/GuiEvents.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 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 GZ_GUI_GUIEVENTS_HH_
18 #define GZ_GUI_GUIEVENTS_HH_
19 
20 #include <QEvent>
21 #include <string>
22 #include <utility>
23 #include <vector>
24 #include <gz/math/Vector3.hh>
25 
26 namespace ignition
27 {
28  namespace gui
29  {
31  namespace events
32  {
35 
38  class Render : public QEvent
39  {
40  public: Render()
41  : QEvent(kType)
42  {
43  }
45  static const QEvent::Type kType = QEvent::Type(QEvent::MaxUser);
46  };
47 
51  class SnapIntervals : public QEvent
52  {
57  public: SnapIntervals(
58  const math::Vector3d &_xyz,
59  const math::Vector3d &_rpy,
60  const math::Vector3d &_scale)
61  : QEvent(kType), xyz(_xyz), rpy(_rpy), scale(_scale)
62  {
63  }
64 
67  public: math::Vector3d Position() const
68  {
69  return this->xyz;
70  }
71 
74  public: math::Vector3d Rotation() const
75  {
76  return this->rpy;
77  }
78 
81  public: math::Vector3d Scale() const
82  {
83  return this->scale;
84  }
85 
87  static const QEvent::Type kType = QEvent::Type(QEvent::MaxUser - 1);
88 
90  private: math::Vector3d xyz;
91 
94  private: math::Vector3d rpy;
95 
98  private: math::Vector3d scale;
99  };
100 
104  {
108  public: explicit SpawnFromDescription(const std::string &_description)
109  : QEvent(kType), description(_description)
110  {
111  }
112 
114  static const QEvent::Type kType = QEvent::Type(QEvent::MaxUser - 2);
115 
118  public: const std::string &Description() const
119  {
120  return this->description;
121  }
122 
125  };
126 
129  class SpawnFromPath : public QEvent
130  {
133  public: explicit SpawnFromPath(const std::string &_filePath)
134  : QEvent(kType), filePath(_filePath)
135  {
136  }
137 
139  static const QEvent::Type kType = QEvent::Type(QEvent::MaxUser - 3);
140 
143  public: const std::string &FilePath() const
144  {
145  return this->filePath;
146  }
147 
150  };
151 
154  class HoverToScene : public QEvent
155  {
159  public: explicit HoverToScene(const math::Vector3d &_point)
160  : QEvent(kType), point(_point)
161  {
162  }
163 
165  static const QEvent::Type kType = QEvent::Type(QEvent::MaxUser - 4);
166 
170  public: math::Vector3d Point() const
171  {
172  return this->point;
173  }
174 
176  private: math::Vector3d point;
177  };
178 
181  class LeftClickToScene : public QEvent
182  {
186  public: explicit LeftClickToScene(const math::Vector3d &_point)
187  : QEvent(kType), point(_point)
188  {
189  }
190 
192  static const QEvent::Type kType = QEvent::Type(QEvent::MaxUser - 5);
193 
196  public: math::Vector3d Point() const
197  {
198  return this->point;
199  }
200 
202  private: math::Vector3d point;
203  };
204 
207  class RightClickToScene : public QEvent
208  {
212  public: explicit RightClickToScene(const math::Vector3d &_point)
213  : QEvent(kType), point(_point)
214  {
215  }
216 
218  static const QEvent::Type kType = QEvent::Type(QEvent::MaxUser - 6);
219 
222  public: math::Vector3d Point() const
223  {
224  return this->point;
225  }
226 
228  private: math::Vector3d point;
229  };
230 
235  {
239  public: explicit DropdownMenuEnabled(bool _menuEnabled)
240  : QEvent(kType), menuEnabled(_menuEnabled)
241  {
242  }
243 
245  static const QEvent::Type kType = QEvent::Type(QEvent::MaxUser - 7);
246 
249  public: bool MenuEnabled() const
250  {
251  return this->menuEnabled;
252  }
253 
256  private: bool menuEnabled;
257  };
258  }
259  }
260 }
261 
262 #endif // GZ_GUI_GUIEVENTS_HH_
math::Vector3d Position() const
Get the XYZ snapping values.
Definition: gz/gui/GuiEvents.hh:67
static const QEvent::Type kType
Unique type for this event.
Definition: gz/gui/GuiEvents.hh:165
HoverToScene(const math::Vector3d &_point)
Constructor.
Definition: gz/gui/GuiEvents.hh:159
math::Vector3d Point() const
Get the point within the scene that the user clicked.
Definition: gz/gui/GuiEvents.hh:222
STL class.
static const QEvent::Type kType
Unique type for this event.
Definition: gz/gui/GuiEvents.hh:45
Render()
Definition: gz/gui/GuiEvents.hh:40
static const QEvent::Type kType
The QEvent representing a snap event occurrence.
Definition: gz/gui/GuiEvents.hh:87
const std::string & FilePath() const
Get the path of the file.
Definition: gz/gui/GuiEvents.hh:143
Event called in the render thread of a 3D scene. It's safe to make rendering calls in this event's ca...
Definition: gz/gui/GuiEvents.hh:38
LeftClickToScene(const math::Vector3d &_point)
Constructor.
Definition: gz/gui/GuiEvents.hh:186
Event called to spawn a resource, which takes the path to its file.
Definition: gz/gui/GuiEvents.hh:129
const std::string & Description() const
Get the string description of the resource.
Definition: gz/gui/GuiEvents.hh:118
std::string filePath
The path of file to be previewed.
Definition: gz/gui/GuiEvents.hh:149
DropdownMenuEnabled(bool _menuEnabled)
Constructor.
Definition: gz/gui/GuiEvents.hh:239
static const QEvent::Type kType
Unique type for this event.
Definition: gz/gui/GuiEvents.hh:139
SpawnFromDescription(const std::string &_description)
Constructor.
Definition: gz/gui/GuiEvents.hh:108
Event which is called to broadcast the 3D coordinates of a user's left click within the scene.
Definition: gz/gui/GuiEvents.hh:181
math::Vector3d Point() const
Get the point within the scene over which the user is hovering.
Definition: gz/gui/GuiEvents.hh:170
std::string description
The string of the resource to be spawned.
Definition: gz/gui/GuiEvents.hh:124
Event which is called to broadcast the 3D coordinates of a user's right click within the scene.
Definition: gz/gui/GuiEvents.hh:207
Event called to spawn a resource, given its description as a string.
Definition: gz/gui/GuiEvents.hh:103
math::Vector3d Scale() const
Get the scale snapping values.
Definition: gz/gui/GuiEvents.hh:81
math::Vector3d Point() const
Get the point within the scene that the user clicked.
Definition: gz/gui/GuiEvents.hh:196
RightClickToScene(const math::Vector3d &_point)
Constructor.
Definition: gz/gui/GuiEvents.hh:212
bool MenuEnabled() const
Gets whether the menu is enabled or not for this event.
Definition: gz/gui/GuiEvents.hh:249
The class for sending and receiving custom snap value events. This event is used in the Transform Con...
Definition: gz/gui/GuiEvents.hh:51
math::Vector3d Rotation() const
Get the RPY snapping values.
Definition: gz/gui/GuiEvents.hh:74
static const QEvent::Type kType
Unique type for this event.
Definition: gz/gui/GuiEvents.hh:192
Event which is called to broadcast the 3D coordinates of a user's mouse hover within the scene.
Definition: gz/gui/GuiEvents.hh:154
static const QEvent::Type kType
Unique type for this event.
Definition: gz/gui/GuiEvents.hh:218
SnapIntervals(const math::Vector3d &_xyz, const math::Vector3d &_rpy, const math::Vector3d &_scale)
Constructor.
Definition: gz/gui/GuiEvents.hh:57
Event which is called to enable or disable the dropdown menu. This is primarily used by plugins which...
Definition: gz/gui/GuiEvents.hh:234
SpawnFromPath(const std::string &_filePath)
Constructor.
Definition: gz/gui/GuiEvents.hh:133
static const QEvent::Type kType
Unique type for this event.
Definition: gz/gui/GuiEvents.hh:245
static const QEvent::Type kType
Unique type for this event.
Definition: gz/gui/GuiEvents.hh:114