gepetto-viewer  4.13.0
An user-friendly Graphical Interface
bodytreewidget.hh
Go to the documentation of this file.
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 <QStandardItemModel>
21 #include <QToolBox>
22 #include <QTreeView>
23 #include <QVector3D>
24 #include <QWidget>
25 #include <gepetto/gui/fwd.hh>
26 
27 namespace gepetto {
28 namespace gui {
30 class BodyTreeWidget : public QWidget {
31  Q_OBJECT
32 
33  public:
34  explicit BodyTreeWidget(QWidget* parent = NULL) : QWidget(parent) {}
35 
39  void init(QTreeView* view, QWidget* propertyArea);
40 
41  virtual ~BodyTreeWidget() {}
42 
44  QTreeView* view();
45 
46  QStandardItemModel* model() { return model_; }
47 
48  void emitBodySelected(SelectionEvent* event);
49 
50  signals:
51  void bodySelected(SelectionEvent* event);
52 
53  public slots:
56 
59  void selectBodyByName(const QString bodyName);
60 
63  void selectBodyByName(const std::string& bodyName);
64 
66  QList<BodyTreeItem*> selectedBodies() const;
67 
69 
70  protected slots:
73  void customContextMenu(const QPoint& pos);
74 
75  void currentChanged(const QModelIndex& current, const QModelIndex& previous);
76 
77  private:
82  void handleSelectionEvent(const SelectionEvent* event);
83 
84  void updatePropertyArea(BodyTreeItem* item);
85 
86  QTreeView* view_;
87  QStandardItemModel* model_;
89  QWidget* propertyArea_;
90 };
91 } // namespace gui
92 } // namespace gepetto
93 
94 #endif // GEPETTO_GUI_BODYTREEWIDGET_HH
void init(QTreeView *view, QWidget *propertyArea)
Definition: tree-item.hh:31
virtual ~BodyTreeWidget()
Definition: bodytreewidget.hh:41
void currentChanged(const QModelIndex &current, const QModelIndex &previous)
QTreeView * view()
Get the body tree view.
void selectBodyByName(const QString bodyName)
Contains the list of all the bodies in the scene.
Definition: bodytreewidget.hh:30
Definition: selection-event.hh:30
Definition: action-search-bar.hh:26
QList< BodyTreeItem * > selectedBodies() const
Get selected bodies.
void emitBodySelected(SelectionEvent *event)
QStandardItemModel * model()
Definition: bodytreewidget.hh:46
void customContextMenu(const QPoint &pos)
BodyTreeWidget(QWidget *parent=NULL)
Definition: bodytreewidget.hh:34
viewer::shared_ptr< WindowsManager > WindowsManagerPtr_t
Definition: fwd.hh:58
void bodySelected(SelectionEvent *event)