Gazebo Sim

API Reference

8.6.0
EntityContextMenu.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 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_SIM_GUI_ENTITYCONTEXTMENU_HH_
19 #define GZ_SIM_GUI_ENTITYCONTEXTMENU_HH_
20 
21 #include <gz/gui/qt.h>
22 #include <gz/msgs/cameratrack.pb.h>
23 #include <QtQml/QQmlExtensionPlugin>
24 #include <memory>
25 
26 namespace gz
27 {
28 namespace sim
29 {
30  class EntityContextMenuPrivate;
31 
34  class GzSimPlugin : public QQmlExtensionPlugin
35  {
36  Q_OBJECT
37 
38  // unique id
39  Q_PLUGIN_METADATA(IID "GzSim/1.0")
40 
41 
43  public: void registerTypes(const char *_uri) override;
44  };
45 
47  class EntityContextMenu : public QQuickItem
48  {
49  Q_OBJECT
51  Q_PROPERTY(
52  bool followingTarget
53  READ FollowingTarget
54  WRITE SetFollowingTarget
56  )
57 
58 
59  public: EntityContextMenu();
60 
62  public: ~EntityContextMenu() override;
63 
66  public: Q_INVOKABLE bool FollowingTarget() const;
67 
70  public: Q_INVOKABLE void SetFollowingTarget(bool &_followingTarget);
71 
73  signals: void FollowingTargetChanged();
74 
77  public: void OnCurrentlyTrackedSub(const msgs::CameraTrack &_msg);
78 
82  public: Q_INVOKABLE void OnRemove(
83  const QString &_data, const QString &_type);
84 
88  public: Q_INVOKABLE void OnRequest(const QString &_request,
89  const QString &_data);
90 
93  private: std::unique_ptr<EntityContextMenuPrivate> dataPtr;
94  };
95 }
96 }
97 
98 #endif