Computer Assited Medical Intervention Tool Kit  version 4.1
Public Slots | Private Slots | List of all members
camitk::Explorer Class Reference

Explorer window, display the list of all data currently opened in the application. More...

#include <Explorer.h>

Inherits camitk::Viewer.

Public Slots

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

Public Member Functions

Inherited from Viewer
unsigned int numberOfViewedComponent () override
 
void refresh (Viewer *whoIsAsking=nullptr) override
 refresh the explorer (can be interesting to know which other viewer is calling this) More...
 
QWidget * getWidget (QWidget *parent) override
 get the explorer widget (QTreeWidget). More...
 
QMenu * getMenu () override
 get the explorer menu More...
 
virtual QWidget * getPreferenceWidget (QWidget *parent)
 get the explorer preference widget (widget where all preferences can be modified). More...
 
void refreshInterfaceNode (Component *comp) override
 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...
 
- Public Member Functions inherited from camitk::Viewer
virtual QObject * getPropertyObject ()
 get the viewer property object (returns NULL by default, i.e. there are no property to edit) More...
 
virtual QToolBar * getToolBar ()
 get the viewer toolbar (returns NULL by default, i.e. there are no default toolbar) More...
 
 Viewer (QString name)
 default constructor More...
 
 ~Viewer () override=default
 default destructor More...
 

Private Slots

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

Private Attributes

Menu

the QMenu for the explorer

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

General

 Explorer ()
 Construtor. More...
 
 ~Explorer () override
 Destructor. More...
 
static ExplorergetInstance ()
 returns the unique instance of ActionViewer More...
 

QTreeWidgetItem/InterfaceNode map

the map to get the Component* from the QTreeWidgetItem*

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

QTreeWidget and QTreeWidgetItem management

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

QTreeWidget * explorerTree
 the list view More...
 
QTreeWidgetItem * getNewItem (QTreeWidgetItem *parent, Component *)
 
QTreeWidgetItem * add (QTreeWidgetItem *, Component *)
 recursively add the Component in the tree explorer and return the QTreeWidgetItem of the InterfaceNode More...
 
void add (Component *comp)
 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 remove (Component *comp)
 Remove the Component (its Component and its sub-item) from the explorer list (if present). More...
 

Additional Inherited Members

- Signals inherited from camitk::Viewer
void selectionChanged ()
 this signal is emitted when the current selection was changed by the viewer More...
 
- Protected Member Functions inherited from camitk::Viewer
void clearSelection ()
 clear the selection More...
 
void selectionChanged (ComponentList &compSet)
 The selection has changed to the given ComponentList. More...
 
void selectionChanged (Component *comp)
 the selection has changed to be just one comp More...
 

Detailed Description

Explorer window, display 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).

explorer.png
The component explorer viewer.

This viewer also manages a singleton (THE CamiTK explorer). See getInstance() for more information. You do not have to use it, but it is convienent (and sometimes preferable) to use this instance instead of creating your own one.

Constructor & Destructor Documentation

◆ Explorer()

camitk::Explorer::Explorer ( )

Construtor.

References explorerMenu, and explorerTree.

Referenced by getInstance().

◆ ~Explorer()

camitk::Explorer::~Explorer ( )
override

Destructor.

References explorerMenu, and explorerTree.

Member Function Documentation

◆ add() [1/2]

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

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

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

Referenced by add(), refresh(), and refreshInterfaceNode().

◆ add() [2/2]

void camitk::Explorer::add ( Component comp)
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.

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

◆ doubleClicked

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

slot called when an item was double clicked

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

Referenced by getWidget().

◆ getInstance()

Explorer * camitk::Explorer::getInstance ( )
static

returns the unique instance of ActionViewer

References Explorer().

◆ getItem()

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

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

References itemComponentMap.

Referenced by refresh(), and refreshInterfaceNode().

◆ getMenu()

QMenu * camitk::Explorer::getMenu ( )
overridevirtual

get the explorer menu

Reimplemented from camitk::Viewer.

References editRename, explorerMenu, camitk::Application::getSelectedComponents(), and renameItem().

◆ getNewItem()

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

◆ getPreferenceWidget()

QWidget * camitk::Explorer::getPreferenceWidget ( QWidget *  parent)
virtual

get the explorer preference widget (widget where all preferences can be modified).

Parameters
parentthe parent widget for the preference widget

◆ getWidget()

QWidget * camitk::Explorer::getWidget ( QWidget *  parent)
overridevirtual

get the explorer widget (QTreeWidget).

Parameters
parentthe parent widget for the viewer widget

Implements camitk::Viewer.

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

◆ numberOfViewedComponent()

unsigned int camitk::Explorer::numberOfViewedComponent ( )
overridevirtual

returns the number of Component that are displayed by this viewer

Implements camitk::Viewer.

References itemComponentMap.

◆ refresh()

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

◆ refreshInterfaceNode()

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

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.

Reimplemented from camitk::Viewer.

References add(), explorerTree, and getItem().

Referenced by doubleClicked(), and renameItem().

◆ remove() [1/2]

void camitk::Explorer::remove ( QTreeWidgetItem *  tw)
private

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

References camitk::Application::isAlive(), and itemComponentMap.

◆ remove() [2/2]

void camitk::Explorer::remove ( 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, and itemCompMap.

◆ renameItem

void camitk::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().

◆ rightButtonPressed

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

slot called on right button click

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

Referenced by getWidget().

◆ selectionChanged

void camitk::Explorer::selectionChanged ( )
privateslot

slot called whenever the selection changed in the explorer

References camitk::Application::clearSelectedComponents(), explorerTree, itemComponentMap, refresh(), and camitk::Viewer::selectionChanged().

Referenced by doubleClicked(), and getWidget().

Member Data Documentation

◆ editRename

QAction* camitk::Explorer::editRename
private

the possible action

Referenced by getMenu(), and refresh().

◆ explorerMenu

QMenu* camitk::Explorer::explorerMenu
private

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

◆ explorerTree

QTreeWidget* camitk::Explorer::explorerTree
private

◆ itemCompMap

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

the map to get the QTreeWidgetItem corresponding to a parentComp

Referenced by add(), refresh(), and remove().

◆ itemComponentMap

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

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