Gazebo Sim

API Reference

10.0.0~pre1
EntityContextMenuPlugin.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2021 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 GZ_GUI_PLUGINS_ENTITY_CONTEXT_MENU_HH_
19#define GZ_GUI_PLUGINS_ENTITY_CONTEXT_MENU_HH_
20
21#include <memory>
22
24
25#include <gz/gui/Plugin.hh>
26
27#include <gz/rendering/Camera.hh>
28
29namespace gz
30{
31namespace sim
32{
33 class EntityContextMenuPrivate;
34
37 class EntityContextMenu : public gz::gui::Plugin
38 {
39 Q_OBJECT
40
43
45 public: ~EntityContextMenu() override;
46
47 // Documentation inherited
48 public: void LoadConfig(const tinyxml2::XMLElement *_pluginElem) override;
49
50 // Documentation inherited
51 protected: bool eventFilter(QObject *_obj, QEvent *_event) override;
52
56 };
57
58 class EntityContextMenuHandler : public QObject
59 {
60 Q_OBJECT
61
64
68 public: void HandleMouseContextMenu(const common::MouseEvent &_mouseEvent,
69 const rendering::CameraPtr &_camera);
70
73 signals: void ContextMenuRequested(QString _entity);
74 };
75
77 class EntityContextMenuItem : public QQuickItem
78 {
79 Q_OBJECT
80
83 public: explicit EntityContextMenuItem(QQuickItem *_parent = nullptr);
84
88 const EntityContextMenuHandler &_entityContextMenuHandler);
89
94 signals: void openContextMenu(QString _entity); // NOLINT
95
98 public slots: void OnContextMenuRequested(QString _entity);
99 };
100}
101}
102
103#endif