GCC Code Coverage Report


Directory: ./
File: include/gepetto/gui/bodytreewidget.hh
Date: 2024-12-20 15:53:58
Exec Total Coverage
Lines: 0 4 0.0%
Branches: 0 2 0.0%

Line Branch Exec Source
1 // Copyright (c) 2015-2018, LAAS-CNRS
2 // Authors: Joseph Mirabel (joseph.mirabel@laas.fr)
3 //
4 // This file is part of gepetto-viewer.
5 // gepetto-viewer is free software: you can redistribute it
6 // and/or modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation, either version
8 // 3 of the License, or (at your option) any later version.
9 //
10 // gepetto-viewer is distributed in the hope that it will be
11 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
12 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // General Lesser Public License for more details. You should have
14 // received a copy of the GNU Lesser General Public License along with
15 // gepetto-viewer. If not, see <http://www.gnu.org/licenses/>.
16
17 #ifndef GEPETTO_GUI_BODYTREEWIDGET_HH
18 #define GEPETTO_GUI_BODYTREEWIDGET_HH
19
20 #include <gepetto/gui/fwd.hh>
21 // This include must be include before any other Qt include for GLDEBUGPROC
22 #include <QStandardItemModel>
23 #include <QToolBox>
24 #include <QTreeView>
25 #include <QVector3D>
26 #include <QWidget>
27
28 namespace gepetto {
29 namespace gui {
30 /// Contains the list of all the bodies in the scene.
31 class BodyTreeWidget : public QWidget {
32 Q_OBJECT
33
34 public:
35 explicit BodyTreeWidget(QWidget* parent = NULL) : QWidget(parent) {}
36
37 /// Init the widget.
38 /// \param view tree view to display.
39 /// \param propertyArea menu in the window
40 void init(QTreeView* view, QWidget* propertyArea);
41
42 virtual ~BodyTreeWidget() {}
43
44 /// Get the body tree view.
45 QTreeView* view();
46
47 QStandardItemModel* model() { return model_; }
48
49 void emitBodySelected(SelectionEvent* event);
50
51 signals:
52 void bodySelected(SelectionEvent* event);
53
54 public slots:
55 /// \ingroup plugin_python
56 /// \{
57
58 /// Triggered when an item is selected in the body tree view.
59 /// \param bodyName name of the body
60 void selectBodyByName(const QString bodyName);
61
62 /// Triggered when an item is selected in the body tree view.
63 /// \param bodyName name of the body
64 void selectBodyByName(const std::string& bodyName);
65
66 /// Get selected bodies
67 QList<BodyTreeItem*> selectedBodies() const;
68
69 /// \}
70
71 protected slots:
72 /// Display the context menu for one item.
73 /// \param pos position of the item
74 void customContextMenu(const QPoint& pos);
75
76 void currentChanged(const QModelIndex& current, const QModelIndex& previous);
77
78 private:
79 /// Handle a selection event
80 ///
81 /// Does not re-emit a selection event when the body tree selection
82 /// is updated.
83 void handleSelectionEvent(const SelectionEvent* event);
84
85 void updatePropertyArea(BodyTreeItem* item);
86
87 QTreeView* view_;
88 QStandardItemModel* model_;
89 WindowsManagerPtr_t osg_;
90 QWidget* propertyArea_;
91 };
92 } // namespace gui
93 } // namespace gepetto
94
95 #endif // GEPETTO_GUI_BODYTREEWIDGET_HH
96