GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: include/gepetto/gui/bodytreewidget.hh Lines: 0 6 0.0 %
Date: 2020-05-14 11:23:33 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
22
#include <QWidget>
23
#include <QTreeView>
24
#include <QToolBox>
25
#include <QStandardItemModel>
26
#include <QVector3D>
27
28
namespace gepetto {
29
  namespace gui {
30
    /// Contains the list of all the bodies in the scene.
31
    class BodyTreeWidget : public QWidget
32
    {
33
      Q_OBJECT
34
35
    public:
36
      explicit BodyTreeWidget (QWidget* parent = NULL)
37
        : QWidget (parent)
38
      {}
39
40
      /// Init the widget.
41
      /// \param view tree view to display.
42
      /// \param propertyArea menu in the window
43
      void init(QTreeView *view, QWidget *propertyArea);
44
45
      virtual ~BodyTreeWidget () {}
46
47
      /// Get the body tree view.
48
      QTreeView* view ();
49
50
      QStandardItemModel* model()
51
      {
52
        return model_;
53
      }
54
55
      void emitBodySelected (SelectionEvent* event);
56
57
    signals:
58
      void bodySelected (SelectionEvent* event);
59
60
    public slots:
61
      /// \ingroup plugin_python
62
      /// \{
63
64
      /// Triggered when an item is selected in the body tree view.
65
      /// \param bodyName name of the body
66
      void selectBodyByName (const QString bodyName);
67
68
      /// Triggered when an item is selected in the body tree view.
69
      /// \param bodyName name of the body
70
      void selectBodyByName (const std::string& bodyName);
71
72
      /// Get selected bodies
73
      QList<BodyTreeItem*> selectedBodies() const;
74
75
      /// \}
76
77
    protected slots:
78
      /// Display the context menu for one item.
79
      /// \param pos position of the item
80
      void customContextMenu (const QPoint& pos);
81
82
      void currentChanged (const QModelIndex &current,
83
                           const QModelIndex &previous);
84
85
    private:
86
      /// Handle a selection event
87
      ///
88
      /// Does not re-emit a selection event when the body tree selection
89
      /// is updated.
90
      void handleSelectionEvent (const SelectionEvent* event);
91
92
      void updatePropertyArea (BodyTreeItem* item);
93
94
      QTreeView* view_;
95
      QStandardItemModel* model_;
96
      WindowsManagerPtr_t osg_;
97
      QWidget* propertyArea_;
98
    };
99
  }
100
}
101
102
#endif // GEPETTO_GUI_BODYTREEWIDGET_HH