ModelTreeWidget.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 #ifndef _GAZEBO_GUI_MODEL_MODELTREEWIDGET_HH_
18 #define _GAZEBO_GUI_MODEL_MODELTREEWIDGET_HH_
19 
20 #include <mutex>
21 #include <string>
22 #include <vector>
23 
24 #include "gazebo/common/Event.hh"
26 
27 #include "gazebo/gui/qt.h"
28 #include "gazebo/util/system.hh"
29 
30 namespace gazebo
31 {
32  namespace gui
33  {
34  class ModelPluginInspector;
35 
38 
41  class GZ_GUI_VISIBLE ModelTreeWidget : public QWidget
42  {
43  Q_OBJECT
44 
47  public: ModelTreeWidget(QWidget *_parent = 0);
48 
50  public: ~ModelTreeWidget() = default;
51 
55  private: void OnDeselectAll(const std::string &_name,
56  const std::string &_mode);
57 
62  private: void OnSetSelectedEntity(const std::string &_entityId,
63  const bool _selected);
64 
69  private: void OnSetSelectedJoint(const std::string &_jointId,
70  const bool _selected);
71 
76  private: void OnSetSelectedModelPlugin(const std::string &_name,
77  const bool _selected);
78 
82  private: void DeselectType(const std::string &_type);
83 
85  private slots: void OnStatic();
86 
88  private slots: void OnAutoDisable();
89 
92  private slots: void OnNameChanged(const QString &_name);
93 
97  private slots: void OnItemDoubleClicked(QTreeWidgetItem *_item,
98  int _column);
99 
103  private slots: void OnItemClicked(QTreeWidgetItem *_item, int _column);
104 
106  private slots: void OnItemSelectionChanged();
107 
111  private slots: void OnCustomContextMenu(const QPoint &_pt);
112 
114  private slots: void OnAddModelPlugin();
115 
118  private slots: void OnModelPluginApply();
119 
122  private: void OnLinkInserted(const std::string &_linkName);
123 
129  private: void OnJointInserted(const std::string &_jointId,
130  const std::string &_jointName, const std::string &_parentName,
131  const std::string &_childName);
132 
135  private: void OnModelPluginInserted(const std::string &_modelPluginName);
136 
139  private: void OnNestedModelInserted(const std::string &_nestedModelName);
140 
143  private: void OnLinkRemoved(const std::string &_linkId);
144 
147  private: void OnJointRemoved(const std::string &_jointId);
148 
151  private: void OnModelPluginRemoved(const std::string &_pluginId);
152 
155  private: void OnNestedModelRemoved(const std::string &_nestedModelId);
156 
158  private: void ClearModelTree();
159 
163  private: void OnJointNameChanged(const std::string &_jointId,
164  const std::string &_newJointName);
165 
169  private: void OnSaveModel(const std::string &_saveName);
170 
172  private: void OnNewModel();
173 
177  private: void OnModelPropertiesChanged(bool _static, bool _autoDisable);
178 
181  private: void OnModelNameChanged(const std::string &_name);
182 
188  private: QTreeWidgetItem *FindItemByData(const std::string &_data,
189  const QTreeWidgetItem &_parentItem);
190 
192  private: std::vector<event::ConnectionPtr> connections;
193 
195  private: QCheckBox *staticCheck;
196 
199  private: QCheckBox *autoDisableCheck;
200 
202  private: std::string modelDefaultName;
203 
205  private: QLineEdit *modelNameEdit;
206 
208  private: QTreeWidget *modelTreeWidget;
209 
211  private: QTreeWidgetItem *nestedModelsItem;
212 
214  private: QTreeWidgetItem *linksItem;
215 
217  private: QTreeWidgetItem *jointsItem;
218 
220  private: QTreeWidgetItem *modelPluginsItem;
221 
223  private: std::recursive_mutex updateMutex;
224 
226  private: QList<QTreeWidgetItem *> selected;
227 
229  private: ModelPluginInspector *modelPluginInspector;
230  };
231  }
232 }
233 #endif
Forward declarations for the common classes.
Definition: Animation.hh:33
A widget that displays model properties.
Definition: ModelTreeWidget.hh:41
Inspector for model plugin properties.
Definition: ModelPluginInspector.hh:35