Computer Assited Medical Intervention Tool Kit  version 4.1
Explorer.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * $CAMITK_LICENCE_BEGIN$
3  *
4  * CamiTK - Computer Assisted Medical Intervention ToolKit
5  * (c) 2001-2018 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
6  *
7  * Visit http://camitk.imag.fr for more information
8  *
9  * This file is part of CamiTK.
10  *
11  * CamiTK is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * CamiTK is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License version 3 for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
22  *
23  * $CAMITK_LICENCE_END$
24  ****************************************************************************/
25 
26 
27 #ifndef EXPLORER_H
28 #define EXPLORER_H
29 
30 // -- Core stuff
31 #include "Viewer.h"
32 
33 // -- QT stuff
34 #include <QTreeWidget>
35 #include <QTreeWidgetItem>
36 
37 namespace camitk {
38 // -- Core stuff classes
39 class InterfaceNode;
40 class Component;
41 class ExplorerItem;
42 class Explorer;
43 
58 class CAMITK_API Explorer : public Viewer {
59  Q_OBJECT
60 
61 public:
64 
66  Explorer();
67 
69  ~Explorer() override;
70 
72  static Explorer* getInstance();
74 
77  unsigned int numberOfViewedComponent() override;
80 
82  void refresh(Viewer* whoIsAsking = nullptr) override;
83 
85  QWidget* getWidget(QWidget* parent) override;
86 
88  QMenu* getMenu() override;
89 
91  virtual QWidget* getPreferenceWidget(QWidget* parent);
92 
100  void refreshInterfaceNode(Component* comp) override;
102 
103 public slots :
104 
106  void renameItem();
107 
108 private slots :
109 
111  void selectionChanged();
112 
114  void doubleClicked(QTreeWidgetItem*, int);
115 
117  void rightButtonPressed(const QPoint&);
118 
119 private:
120 
124  QMap<QTreeWidgetItem*, Component*> itemComponentMap;
125 
127  QMap<Component*, QTreeWidgetItem*> itemCompMap;
128 
130  QTreeWidgetItem* getItem(Component*);
132 
136  QTreeWidgetItem* getNewItem(QTreeWidgetItem* parent, Component*);
137 
139  QTreeWidgetItem* add(QTreeWidgetItem*, Component*);
140 
144  void add(Component* comp);
145 
147  void remove(QTreeWidgetItem*);
148 
152  void remove(Component* comp);
153 
154 
156  QTreeWidget* explorerTree;
158 
162  QMenu* explorerMenu;
163 
165  QAction* editRename;
167 };
168 
169 }
170 
171 
172 #endif
Viewer is an abstract viewer.
Definition: Viewer.h:55
QMap< Component *, QTreeWidgetItem * > itemCompMap
the map to get the QTreeWidgetItem corresponding to a parentComp
Definition: Explorer.h:127
Definition: Action.cpp:36
A Component represents something that could be included in the explorer view, the interactive 3D view...
Definition: sdk/libraries/core/component/Component.h:298
Explorer window, display the list of all data currently opened in the application.
Definition: Explorer.h:58
#define CAMITK_API
Definition: CamiTKAPI.h:49
A component is something that composed something and could also be a part of something.
Definition: modeling/libraries/pml/Component.h:48
QMap< QTreeWidgetItem *, Component * > itemComponentMap
Definition: Explorer.h:124
QMenu * explorerMenu
Definition: Explorer.h:162
QAction * editRename
the possible action
Definition: Explorer.h:165
QTreeWidget * explorerTree
the list view
Definition: Explorer.h:156