Computer Assisted Medical Intervention Tool Kit  version 5.2
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-2024 Univ. Grenoble Alpes, CNRS, Grenoble INP - UGA, TIMC, 38000 Grenoble, France
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 #include "ExplorerAPI.h"
31 
32 // -- Core stuff
33 #include <Viewer.h>
34 
35 // -- QT stuff
36 #include <QTreeWidget>
37 #include <QTreeWidgetItem>
38 
39 namespace camitk {
40 // -- Core stuff classes
41 class InterfaceNode;
42 class Component;
43 class ExplorerItem;
44 }
45 
65  Q_OBJECT
66 
67 public:
71 
72  Q_INVOKABLE Explorer(QString);
73 
75  ~Explorer() override;
76 
81  void refresh(camitk::Viewer* whoIsAsking = nullptr) override;
82 
84  QWidget* getWidget() override;
85 
87  QMenu* getMenu() override;
88 
90 
91 public slots :
92 
94  void renameItem();
95 
96 private slots :
97 
99  void explorerSelectionChanged();
100 
102  void doubleClicked(QTreeWidgetItem*, int);
103 
105  void rightButtonPressed(const QPoint&);
106 
107 private:
108 
112  QMap<QTreeWidgetItem*, camitk::Component*> itemComponentMap;
113 
115  QMap<camitk::Component*, QTreeWidgetItem*> topLevelCompItemMap;
116 
118  QTreeWidgetItem* getItem(camitk::Component*);
120 
124  QTreeWidgetItem* getNewItem(QTreeWidgetItem* parent, camitk::Component*);
125 
127  QTreeWidgetItem* add(QTreeWidgetItem*, camitk::Component*);
128 
133  void addTopLevel(camitk::Component* comp, int index = -1);
134 
136  void remove(QTreeWidgetItem*);
137 
141  void removeTopLevel(camitk::Component* comp);
142 
150  void refreshInterfaceNode(camitk::Component* comp);
151 
153  QTreeWidget* explorerTree;
155 
159  QMenu* explorerMenu;
160 
162  QAction* editRename;
164 };
165 
166 #endif
#define EXPLORER_API
Definition: ExplorerAPI.h:54
A component is something that composed something and could also be a part of something.
Definition: modeling/libraries/pml/Component.h:48
The Explorer viewer displays the list of all data currently opened in the application.
Definition: Explorer.h:64
A Component represents something that could be included in the explorer view, the interactive 3D view...
Definition: sdk/libraries/core/component/Component.h:303
Viewer is an abstract class that is the base class for all viewers.
Definition: Viewer.h:181
virtual QMenu * getMenu()
get the viewer menu (returns nullptr by default, i.e. there are no default edit menu)
Definition: Viewer.h:246
virtual QWidget * getWidget()=0
get the viewer widget.
virtual void refresh(Viewer *whoIsAsking=nullptr)=0
refresh the view (can be interesting to know which other viewer is calling this)
Definition: Action.cpp:36
void rightButtonPressed()
send when the mouse right button is clicked