Computer Assited Medical Intervention Tool Kit  version 5.0
Explorer Class Reference

The Explorer viewer displays the list of all data currently opened in the application. All objects are displayed in a QListView widget and can be selected (single/multiple selection is available). More...

#include <Explorer.h>

+ Inheritance diagram for Explorer:
+ Collaboration diagram for Explorer:

Public Slots

void renameItem ()
 slot called by the explorer menu when the user wants to rename the currently selected Component More...
 

Public Member Functions

General
Q_INVOKABLE Explorer (QString)
 Construtor. More...
 
 ~Explorer () override
 Destructor. More...
 
Inherited from Viewer
void refresh (camitk::Viewer *whoIsAsking=nullptr) override
 
QWidget * getWidget () override
 get the explorer widget (QTreeWidget) More...
 
QMenu * getMenu () override
 get the explorer menu More...
 
- Public Member Functions inherited from camitk::Viewer
QStringList getComponents ()
 get the list of Component class manages by this viewer (default is set to "Component", i.e. More...
 
QString getDescription () const
 get the name of the viewer More...
 
QDockWidget * getDockWidget ()
 Get the QDockWidget* where this viewer is currently docked (or nullptr if it is not docked anywhere or if the viewer is of type EMBEDDED) More...
 
QLayout * getEmbedder ()
 Get the QLayout* where this viewer is currently embedded (or nullptr if it is not embedded anywhere or if the viewer is of type DOCKED) More...
 
virtual QPixmap getIcon ()
 get the viewer icon More...
 
QString getName () const
 get the name of the viewer More...
 
virtual QObject * getPropertyObject ()
 get the viewer property object (returns nullptr by default, i.e. there are no property to edit) More...
 
virtual QToolBar * getToolBar ()
 get the viewer toolbar (returns nullptr by default, i.e. there are no default toolbar) More...
 
bool getToolBarVisibility ()
 get the current value of the toolbar visibility More...
 
ViewerType getType ()
 get the viewer layout More...
 
 Q_ENUM (ViewerType) Viewer(QString name
 default constructor More...
 
bool setDockWidget (QDockWidget *)
 If the viewer type is DOCKED, dock the widget inside the given dock widget (do nothing if the type is EMBEDDED or if the viewer has already been docked before) Note that once set, the dock widget cannot be modified. More...
 
bool setEmbedder (QLayout *)
 If the viewer type is EMBEDDED, embed the viewer widget in the given layout (do nothing if the type is DOCKED) Note that you can call this method any time you want to move the viewer's widget to another layout (but there is only one embedder at a time) More...
 
void setToolBarVisibility (bool)
 set the visibility of the toolbar in the main window (true by default). More...
 
void setType (ViewerType)
 set the viewer layout (the type can be changed dynamically to fit the developer's purpose) More...
 
void setVisible (bool)
 set the visibility of the viewer (show or hide its widget) More...
 
virtual ~Viewer () override
 default destructor More...
 

Private Slots

void doubleClicked (QTreeWidgetItem *, int)
 slot called when an item was double clicked More...
 
void explorerSelectionChanged ()
 slot called whenever the selection changed in the explorer More...
 
void rightButtonPressed (const QPoint &)
 slot called on right button click More...
 

Private Attributes

Menu

the QMenu for the explorer

QMenu * explorerMenu
 
QAction * editRename
 the possible action More...
 

QTreeWidgetItem/InterfaceNode map

the map to get the Component* from the QTreeWidgetItem*

QMap< QTreeWidgetItem *, camitk::Component * > itemComponentMap
 
QMap< camitk::Component *, QTreeWidgetItem * > topLevelCompItemMap
 the map to get the QTreeWidgetItem corresponding to a parentComp More...
 
QTreeWidgetItem * getItem (camitk::Component *)
 Return the QTreeWidgetItem of a given Component (return nullptr if not found) More...
 

QTreeWidget and QTreeWidgetItem management

instantiate a new QTreeWidgetItem using names and properties from the InterfaceNode, and using parent

QTreeWidget * explorerTree
 the list view More...
 
QTreeWidgetItem * getNewItem (QTreeWidgetItem *parent, camitk::Component *)
 
QTreeWidgetItem * add (QTreeWidgetItem *, camitk::Component *)
 recursively add the Component in the tree explorer and return the QTreeWidgetItem of the InterfaceNode More...
 
void addTopLevel (camitk::Component *comp, int index=-1)
 Add the given Component to the explorer (at top level) and automatically create children Component items. More...
 
void remove (QTreeWidgetItem *)
 remove a given item from the explorer (return its index in the parent item list) More...
 
void removeTopLevel (camitk::Component *comp)
 Remove the Component (its Component and its sub-item) from the explorer list (if present). More...
 
void refreshInterfaceNode (camitk::Component *comp)
 Update the interface node representation of a given Component, (creates a new sub-item for all the new sub items and delete all the sub-item which are not sub items any more). More...
 

Additional Inherited Members

- Public Types inherited from camitk::Viewer
enum  ViewerType { EMBEDDED, DOCKED }
 
- Signals inherited from camitk::Viewer
void selectionChanged ()
 this signal is emitted when the current selection was changed by the viewer More...
 
- Public Attributes inherited from camitk::Viewer
ViewerType type = EMBEDDED)
 this viewer's layout More...
 
- Protected Member Functions inherited from camitk::Viewer
void clearSelection ()
 clear the selection More...
 
void selectionChanged (Component *comp)
 the selection has changed to be just one comp More...
 
void selectionChanged (ComponentList &compSet)
 The selection has changed to the given ComponentList. More...
 
void setComponents (QStringList)
 set the list of component class names managed by this viewer More...
 
void setDescription (QString)
 set the viewer's description More...
 
void setIcon (QPixmap icon)
 set the default icon for the viewer extension More...
 

Detailed Description

The Explorer viewer displays the list of all data currently opened in the application. All objects are displayed in a QListView widget and can be selected (single/multiple selection is available).

The component explorer viewer.

It manages the camitk::InterfaceNode facet of components.

If this viewer extension is loaded, the default instance of this viewer can be accessed directly by Application::getViewer("Frame Explorer").

See also
camitk::InterfaceNode
camitk::Viewer

Constructor & Destructor Documentation

◆ Explorer()

Explorer::Explorer ( QString  name)

Construtor.

References explorerMenu, explorerTree, camitk::Viewer::setDescription(), and camitk::Viewer::setIcon().

+ Here is the call graph for this function:

◆ ~Explorer()

Explorer::~Explorer ( )
override

Destructor.

References explorerMenu, and explorerTree.

Member Function Documentation

◆ add()

QTreeWidgetItem * Explorer::add ( QTreeWidgetItem *  parent,
camitk::Component abstractNode 
)
private

recursively add the Component in the tree explorer and return the QTreeWidgetItem of the InterfaceNode

References camitk::Component::getChildren(), camitk::Viewer::getName(), getNewItem(), itemComponentMap, and camitk::Component::setVisibility().

Referenced by addTopLevel(), and refreshInterfaceNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addTopLevel()

void Explorer::addTopLevel ( camitk::Component comp,
int  index = -1 
)
private

Add the given Component to the explorer (at top level) and automatically create children Component items.

Parameters
compThe Component to add in the tree view.
indexif given insert at a given position

References add(), explorerTree, camitk::Component::getParent(), and topLevelCompItemMap.

Referenced by refresh(), and refreshInterfaceNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doubleClicked

void Explorer::doubleClicked ( QTreeWidgetItem *  tw,
int   
)
privateslot

slot called when an item was double clicked

References camitk::Component::doubleClicked(), explorerSelectionChanged(), itemComponentMap, and refreshInterfaceNode().

Referenced by getWidget().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ explorerSelectionChanged

void Explorer::explorerSelectionChanged ( )
privateslot

slot called whenever the selection changed in the explorer

References explorerTree, itemComponentMap, and refresh().

Referenced by doubleClicked(), and getWidget().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getItem()

QTreeWidgetItem * Explorer::getItem ( camitk::Component comp)
private

Return the QTreeWidgetItem of a given Component (return nullptr if not found)

References itemComponentMap.

Referenced by refresh(), and refreshInterfaceNode().

+ Here is the caller graph for this function:

◆ getMenu()

QMenu * Explorer::getMenu ( )
overridevirtual

get the explorer menu

Reimplemented from camitk::Viewer.

References editRename, explorerMenu, and renameItem().

+ Here is the call graph for this function:

◆ getNewItem()

QTreeWidgetItem * Explorer::getNewItem ( QTreeWidgetItem *  parent,
camitk::Component abstractNode 
)
private

References camitk::Component::getChildren(), camitk::Component::getIcon(), camitk::Component::getName(), and camitk::Component::inItalic().

Referenced by add().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getWidget()

QWidget * Explorer::getWidget ( )
overridevirtual

get the explorer widget (QTreeWidget)

Implements camitk::Viewer.

References doubleClicked(), explorerSelectionChanged(), explorerTree, and rightButtonPressed().

+ Here is the call graph for this function:

◆ refresh()

void Explorer::refresh ( camitk::Viewer whoIsAsking = nullptr)
overridevirtual

refresh the explorer (can be interesting to know which other viewer is calling this)

Implements camitk::Viewer.

References addTopLevel(), editRename, explorerMenu, explorerTree, getItem(), camitk::Component::isSelected(), refreshInterfaceNode(), removeTopLevel(), and topLevelCompItemMap.

Referenced by explorerSelectionChanged().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ refreshInterfaceNode()

void Explorer::refreshInterfaceNode ( camitk::Component comp)
private

Update the interface node representation of a given Component, (creates a new sub-item for all the new sub items and delete all the sub-item which are not sub items any more).

Call this method when the Component has created a new sub-item or when it has removed one of its sub items. If the component was not displayed in the explorer, this method does nothing.

Parameters
compThe InterfaceNode provider to update list.

References add(), addTopLevel(), explorerTree, getItem(), remove(), and removeTopLevel().

Referenced by doubleClicked(), refresh(), and renameItem().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ remove()

void Explorer::remove ( QTreeWidgetItem *  tw)
private

remove a given item from the explorer (return its index in the parent item list)

References camitk::Viewer::getName(), and itemComponentMap.

Referenced by refreshInterfaceNode(), and removeTopLevel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeTopLevel()

void Explorer::removeTopLevel ( camitk::Component comp)
private

Remove the Component (its Component and its sub-item) from the explorer list (if present).

The Component itself is of course not deleted here.

References explorerTree, remove(), and topLevelCompItemMap.

Referenced by refresh(), and refreshInterfaceNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renameItem

void Explorer::renameItem ( )
slot

slot called by the explorer menu when the user wants to rename the currently selected Component

References CAMITK_INFO, explorerTree, camitk::Component::getName(), itemComponentMap, camitk::Component::refresh(), refreshInterfaceNode(), and camitk::Component::setName().

Referenced by getMenu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rightButtonPressed

void Explorer::rightButtonPressed ( const QPoint &  clickedPoint)
privateslot

slot called on right button click

References explorerTree, camitk::Component::getActionMenu(), and itemComponentMap.

Referenced by getWidget().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ editRename

QAction* Explorer::editRename
private

the possible action

Referenced by getMenu(), and refresh().

◆ explorerMenu

QMenu* Explorer::explorerMenu
private

Referenced by Explorer(), getMenu(), refresh(), and ~Explorer().

◆ explorerTree

◆ itemComponentMap

QMap<QTreeWidgetItem*, camitk::Component*> Explorer::itemComponentMap
private

◆ topLevelCompItemMap

QMap<camitk::Component*, QTreeWidgetItem*> Explorer::topLevelCompItemMap
private

the map to get the QTreeWidgetItem corresponding to a parentComp

Referenced by addTopLevel(), refresh(), and removeTopLevel().


The documentation for this class was generated from the following files: