Slicer  4.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
List of all members | Public Types | Properties | Public Slots | Signals | Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes | Friends
qMRMLSubjectHierarchyTreeView Class Reference

#include <Modules/Loadable/SubjectHierarchy/Widgets/qMRMLSubjectHierarchyTreeView.h>

Inheritance diagram for qMRMLSubjectHierarchyTreeView:
Inheritance graph
[legend]
Collaboration diagram for qMRMLSubjectHierarchyTreeView:
Collaboration graph
[legend]

Public Types

typedef QTreeView Superclass
 

Properties

bool contextMenuEnabled
 Flag determining whether context menu is enabled. More...
 
bool editMenuActionVisible
 This property controls whether the Edit properties context menu action is visible. Visible by default. More...
 
bool highlightReferencedItems
 
bool multiSelection
 Flag determining whether multiple items can be selected. More...
 
bool showRootItem
 

Public Slots

virtual void collapseItem (vtkIdType itemID)
 Handle collapse item requests in the subject hierarchy tree. Collapses branch. More...
 
void deleteSelectedItems ()
 Delete selected subject hierarchy items and associated data nodes. More...
 
virtual void editCurrentItem ()
 Edit properties of current item. More...
 
virtual void expandItem (vtkIdType itemID)
 Handle expand item requests in the subject hierarchy tree. Expands branch. More...
 
void renameCurrentItem ()
 Rename currently selected one item by popping up a dialog. More...
 
virtual void selectPluginForCurrentItem ()
 Handle manual selection of a plugin as the new owner of a subject hierarchy node. More...
 
void setContextMenuEnabled (bool enabled)
 
virtual void setCurrentItem (vtkIdType itemID)
 Set current (=selected) subject hierarchy item. More...
 
virtual void setCurrentItems (QList< vtkIdType > items)
 Set current (=selected) subject hierarchy items. More...
 
virtual void setCurrentItems (vtkIdList *items)
 Python compatibility function to set current (=selected) subject hierarchy items. More...
 
void setEditMenuActionVisible (bool visible)
 
void setHighlightReferencedItems (bool highlightOn)
 
virtual void setMRMLScene (vtkMRMLScene *scene)
 Set MRML scene. More...
 
virtual void setMultiSelection (bool multiSelectionOn)
 Set multi-selection. More...
 
virtual void setRootItem (vtkIdType itemID)
 Set subject hierarchy item to be the root in the shown tree. More...
 
void setShowRootItem (bool show)
 Set root item visibility. More...
 
bool showContextMenuHint (bool visibility=false)
 
virtual void updateSelectPluginActions ()
 

Signals

void currentItemChanged (vtkIdType)
 
void currentItemModified (vtkIdType)
 

Public Member Functions

bool contextMenuEnabled () const
 
Q_INVOKABLE vtkIdType currentItem () const
 Get current (=selected) item. If there are multiple items selected, then the first one is returned. More...
 
QList< vtkIdType > currentItems ()
 Get current (=selected) items. More...
 
Q_INVOKABLE void currentItems (vtkIdList *selectedItems)
 
Q_INVOKABLE int displayedItemCount () const
 Determine the number of shown items. More...
 
bool editMenuActionVisible () const
 
bool highlightReferencedItems () const
 
Q_INVOKABLE qMRMLSubjectHierarchyModelmodel () const
 
Q_INVOKABLE vtkMRMLScenemrmlScene () const
 
bool multiSelection ()
 Get whether multi-selection is enabled. More...
 
 qMRMLSubjectHierarchyTreeView (QWidget *parent=0)
 
Q_INVOKABLE void removeAttributeFilter ()
 Remove item attribute filtering. More...
 
Q_INVOKABLE vtkIdType rootItem () const
 Get root item of the tree. More...
 
Q_INVOKABLE void setAttributeFilter (const QString &attributeName, const QVariant &attributeValue=QVariant())
 
Q_INVOKABLE void setLevelFilter (QString &levelFilter)
 Set level filter that allows showing only items at a specified level and their parents. Show all items if empty. More...
 
Q_INVOKABLE void setNameFilter (QString &nameFilter)
 Set name filter that allows showing only items containing a specified string (case-insensitive). Show all items if empty. More...
 
bool showRootItem () const
 Get root item visibility. More...
 
Q_INVOKABLE qMRMLSortFilterSubjectHierarchyProxyModelsortFilterProxyModel () const
 
Q_INVOKABLE vtkMRMLSubjectHierarchyNodesubjectHierarchyNode () const
 
virtual ~qMRMLSubjectHierarchyTreeView ()
 

Protected Slots

virtual void expandToDepthFromContextMenu ()
 Expand tree to depth specified by the clicked context menu action. More...
 
virtual void onItemCollapsed (const QModelIndex &collapsedItemIndex)
 Updates subject hierarchy item expanded property when item is collapsed. More...
 
virtual void onItemExpanded (const QModelIndex &expandedItemIndex)
 Updates subject hierarchy item expanded property when item is expanded. More...
 
virtual void onMRMLSceneCloseEnded (vtkObject *sceneObject)
 Called when scene end is finished. Hierarchy is cleared in that case. More...
 
virtual void onMRMLSceneEndBatchProcess (vtkObject *sceneObject)
 Called when batch processing ends. Restores selection, which is lost when the hierarchy is rebuilt. More...
 
virtual void onMRMLSceneStartBatchProcess (vtkObject *sceneObject)
 Called when batch processing starts. Makes sure stored selection does not get emptied before restoring. More...
 
virtual void onSelectionChanged (const QItemSelection &selected, const QItemSelection &deselected)
 
virtual void onSubjectHierarchyItemModified (vtkObject *caller, void *callData)
 
virtual void updateRootItem ()
 

Protected Member Functions

void applyReferenceHighlightForItems (QList< vtkIdType > itemIDs)
 
virtual bool clickDecoration (QMouseEvent *e)
 
vtkIdType firstSelectedSubjectHierarchyItemInBranch (vtkIdType itemID)
 
virtual void keyPressEvent (QKeyEvent *e)
 Handle key press event. More...
 
virtual void mousePressEvent (QMouseEvent *e)
 Handle mouse press event. More...
 
virtual void populateContextMenuForItem (vtkIdType itemID)
 
virtual void populateVisibilityContextMenuForItem (vtkIdType itemID)
 Populate visibility context menu for given subject hierarchy item. More...
 
virtual void setSubjectHierarchyNode (vtkMRMLSubjectHierarchyNode *shNode)
 Set the subject hierarchy node found in the given scene. Called only internally. More...
 
void toggleSubjectHierarchyItemVisibility (vtkIdType itemID)
 Toggle visibility for given subject hierarchy item. More...
 

Protected Attributes

QScopedPointer< qMRMLSubjectHierarchyTreeViewPrivate > d_ptr
 

Friends

class qMRMLSubjectHierarchyComboBox
 

Detailed Description

Definition at line 43 of file qMRMLSubjectHierarchyTreeView.h.

Member Typedef Documentation

◆ Superclass

Definition at line 65 of file qMRMLSubjectHierarchyTreeView.h.

Property Documentation

◆ contextMenuEnabled

bool qMRMLSubjectHierarchyTreeView::contextMenuEnabled
readwrite

Flag determining whether context menu is enabled.

Definition at line 58 of file qMRMLSubjectHierarchyTreeView.h.

◆ editMenuActionVisible

bool qMRMLSubjectHierarchyTreeView::editMenuActionVisible
readwrite

This property controls whether the Edit properties context menu action is visible. Visible by default.

Definition at line 60 of file qMRMLSubjectHierarchyTreeView.h.

◆ highlightReferencedItems

bool qMRMLSubjectHierarchyTreeView::highlightReferencedItems
readwrite

Flag determining whether to highlight items referenced by DICOM. Storing DICOM references: Referenced SOP instance UIDs (in attribute named vtkMRMLSubjectHierarchyConstants::GetDICOMReferencedInstanceUIDsAttributeName()) -> SH item instance UIDs (serialized string lists in subject hierarchy UID vtkMRMLSubjectHierarchyConstants::GetDICOMInstanceUIDName())

Definition at line 56 of file qMRMLSubjectHierarchyTreeView.h.

◆ multiSelection

bool qMRMLSubjectHierarchyTreeView::multiSelection
readwrite

Flag determining whether multiple items can be selected.

Definition at line 62 of file qMRMLSubjectHierarchyTreeView.h.

◆ showRootItem

bool qMRMLSubjectHierarchyTreeView::showRootItem
readwrite

This property controls whether the root item (folder, an item for a data node, or the scene itself), if any is visible. When the root item is visible, it appears as a top-level item, if it is hidden only its children are top-level items. It doesn't have any effect if rootItem() is invalid. Shown by default.

See also
setShowRootItem(), showRootItem(), setRootItem(), setRootIndex()

Definition at line 52 of file qMRMLSubjectHierarchyTreeView.h.

Constructor & Destructor Documentation

◆ qMRMLSubjectHierarchyTreeView()

qMRMLSubjectHierarchyTreeView::qMRMLSubjectHierarchyTreeView ( QWidget *  parent = 0)

◆ ~qMRMLSubjectHierarchyTreeView()

virtual qMRMLSubjectHierarchyTreeView::~qMRMLSubjectHierarchyTreeView ( )
virtual

Member Function Documentation

◆ applyReferenceHighlightForItems()

void qMRMLSubjectHierarchyTreeView::applyReferenceHighlightForItems ( QList< vtkIdType >  itemIDs)
protected

Apply highlight for subject hierarchy items referenced by argument items by DICOM

See also
highlightReferencedItems

◆ clickDecoration()

virtual bool qMRMLSubjectHierarchyTreeView::clickDecoration ( QMouseEvent *  e)
protectedvirtual

Handles clicks on the decoration of items (i.e. icon). In visibility column this means either toggle visibility or show visibility context menu.

Returns
True if decoration of an enabled item was indeed clicked (and event handled). False otherwise

◆ collapseItem

virtual void qMRMLSubjectHierarchyTreeView::collapseItem ( vtkIdType  itemID)
virtualslot

Handle collapse item requests in the subject hierarchy tree. Collapses branch.

◆ contextMenuEnabled()

bool qMRMLSubjectHierarchyTreeView::contextMenuEnabled ( ) const

◆ currentItem()

Q_INVOKABLE vtkIdType qMRMLSubjectHierarchyTreeView::currentItem ( ) const

Get current (=selected) item. If there are multiple items selected, then the first one is returned.

◆ currentItemChanged

void qMRMLSubjectHierarchyTreeView::currentItemChanged ( vtkIdType  )
signal

◆ currentItemModified

void qMRMLSubjectHierarchyTreeView::currentItemModified ( vtkIdType  )
signal

◆ currentItems() [1/2]

QList<vtkIdType> qMRMLSubjectHierarchyTreeView::currentItems ( )

Get current (=selected) items.

◆ currentItems() [2/2]

Q_INVOKABLE void qMRMLSubjectHierarchyTreeView::currentItems ( vtkIdList *  selectedItems)

Get current (=selected) items.

Parameters
vtkIdListfor python compatibility

◆ deleteSelectedItems

void qMRMLSubjectHierarchyTreeView::deleteSelectedItems ( )
slot

Delete selected subject hierarchy items and associated data nodes.

◆ displayedItemCount()

Q_INVOKABLE int qMRMLSubjectHierarchyTreeView::displayedItemCount ( ) const

Determine the number of shown items.

◆ editCurrentItem

virtual void qMRMLSubjectHierarchyTreeView::editCurrentItem ( )
virtualslot

Edit properties of current item.

◆ editMenuActionVisible()

bool qMRMLSubjectHierarchyTreeView::editMenuActionVisible ( ) const

◆ expandItem

virtual void qMRMLSubjectHierarchyTreeView::expandItem ( vtkIdType  itemID)
virtualslot

Handle expand item requests in the subject hierarchy tree. Expands branch.

◆ expandToDepthFromContextMenu

virtual void qMRMLSubjectHierarchyTreeView::expandToDepthFromContextMenu ( )
protectedvirtualslot

Expand tree to depth specified by the clicked context menu action.

◆ firstSelectedSubjectHierarchyItemInBranch()

vtkIdType qMRMLSubjectHierarchyTreeView::firstSelectedSubjectHierarchyItemInBranch ( vtkIdType  itemID)
protected

Return the id of the first subject hierarchy item that is found to be selected within the branch that has the input item id as its root

◆ highlightReferencedItems()

bool qMRMLSubjectHierarchyTreeView::highlightReferencedItems ( ) const

◆ keyPressEvent()

virtual void qMRMLSubjectHierarchyTreeView::keyPressEvent ( QKeyEvent *  e)
protectedvirtual

Handle key press event.

◆ model()

Q_INVOKABLE qMRMLSubjectHierarchyModel* qMRMLSubjectHierarchyTreeView::model ( ) const

◆ mousePressEvent()

virtual void qMRMLSubjectHierarchyTreeView::mousePressEvent ( QMouseEvent *  e)
protectedvirtual

Handle mouse press event.

◆ mrmlScene()

Q_INVOKABLE vtkMRMLScene* qMRMLSubjectHierarchyTreeView::mrmlScene ( ) const

◆ multiSelection()

bool qMRMLSubjectHierarchyTreeView::multiSelection ( )

Get whether multi-selection is enabled.

◆ onItemCollapsed

virtual void qMRMLSubjectHierarchyTreeView::onItemCollapsed ( const QModelIndex &  collapsedItemIndex)
protectedvirtualslot

Updates subject hierarchy item expanded property when item is collapsed.

◆ onItemExpanded

virtual void qMRMLSubjectHierarchyTreeView::onItemExpanded ( const QModelIndex &  expandedItemIndex)
protectedvirtualslot

Updates subject hierarchy item expanded property when item is expanded.

◆ onMRMLSceneCloseEnded

virtual void qMRMLSubjectHierarchyTreeView::onMRMLSceneCloseEnded ( vtkObject *  sceneObject)
protectedvirtualslot

Called when scene end is finished. Hierarchy is cleared in that case.

◆ onMRMLSceneEndBatchProcess

virtual void qMRMLSubjectHierarchyTreeView::onMRMLSceneEndBatchProcess ( vtkObject *  sceneObject)
protectedvirtualslot

Called when batch processing ends. Restores selection, which is lost when the hierarchy is rebuilt.

◆ onMRMLSceneStartBatchProcess

virtual void qMRMLSubjectHierarchyTreeView::onMRMLSceneStartBatchProcess ( vtkObject *  sceneObject)
protectedvirtualslot

Called when batch processing starts. Makes sure stored selection does not get emptied before restoring.

◆ onSelectionChanged

virtual void qMRMLSubjectHierarchyTreeView::onSelectionChanged ( const QItemSelection &  selected,
const QItemSelection &  deselected 
)
protectedvirtualslot

◆ onSubjectHierarchyItemModified

virtual void qMRMLSubjectHierarchyTreeView::onSubjectHierarchyItemModified ( vtkObject *  caller,
void *  callData 
)
protectedvirtualslot

Propagate item modified signal if the item or an item in its branch was selected in that treeview

◆ populateContextMenuForItem()

virtual void qMRMLSubjectHierarchyTreeView::populateContextMenuForItem ( vtkIdType  itemID)
protectedvirtual

Populate general context menu for given subject hierarchy item

Parameters
itemIDSubject hierarchy item ID of the item to show context menu for. It is only used to determine whether empty area or scene was clicked. If not, then use the current items vector so that multi-selection can also be handled.

◆ populateVisibilityContextMenuForItem()

virtual void qMRMLSubjectHierarchyTreeView::populateVisibilityContextMenuForItem ( vtkIdType  itemID)
protectedvirtual

Populate visibility context menu for given subject hierarchy item.

◆ removeAttributeFilter()

Q_INVOKABLE void qMRMLSubjectHierarchyTreeView::removeAttributeFilter ( )

Remove item attribute filtering.

See also
setAttribute

◆ renameCurrentItem

void qMRMLSubjectHierarchyTreeView::renameCurrentItem ( )
slot

Rename currently selected one item by popping up a dialog.

◆ rootItem()

Q_INVOKABLE vtkIdType qMRMLSubjectHierarchyTreeView::rootItem ( ) const

Get root item of the tree.

◆ selectPluginForCurrentItem

virtual void qMRMLSubjectHierarchyTreeView::selectPluginForCurrentItem ( )
virtualslot

Handle manual selection of a plugin as the new owner of a subject hierarchy node.

◆ setAttributeFilter()

Q_INVOKABLE void qMRMLSubjectHierarchyTreeView::setAttributeFilter ( const QString &  attributeName,
const QVariant &  attributeValue = QVariant() 
)

Set attribute filter that allows showing only items that have the specified attribute and their parents.

Parameters
attributeNameName of the attribute by which the items are filtered
attributeValueValue of the specified attribute that needs to match this given value in order for it to be shown. If empty, then existence of the attribute is enough to show. Empty by default

◆ setContextMenuEnabled

void qMRMLSubjectHierarchyTreeView::setContextMenuEnabled ( bool  enabled)
slot

◆ setCurrentItem

virtual void qMRMLSubjectHierarchyTreeView::setCurrentItem ( vtkIdType  itemID)
virtualslot

Set current (=selected) subject hierarchy item.

◆ setCurrentItems [1/2]

virtual void qMRMLSubjectHierarchyTreeView::setCurrentItems ( QList< vtkIdType >  items)
virtualslot

Set current (=selected) subject hierarchy items.

◆ setCurrentItems [2/2]

virtual void qMRMLSubjectHierarchyTreeView::setCurrentItems ( vtkIdList *  items)
virtualslot

Python compatibility function to set current (=selected) subject hierarchy items.

◆ setEditMenuActionVisible

void qMRMLSubjectHierarchyTreeView::setEditMenuActionVisible ( bool  visible)
slot

◆ setHighlightReferencedItems

void qMRMLSubjectHierarchyTreeView::setHighlightReferencedItems ( bool  highlightOn)
slot

◆ setLevelFilter()

Q_INVOKABLE void qMRMLSubjectHierarchyTreeView::setLevelFilter ( QString &  levelFilter)

Set level filter that allows showing only items at a specified level and their parents. Show all items if empty.

◆ setMRMLScene

virtual void qMRMLSubjectHierarchyTreeView::setMRMLScene ( vtkMRMLScene scene)
virtualslot

Set MRML scene.

◆ setMultiSelection

virtual void qMRMLSubjectHierarchyTreeView::setMultiSelection ( bool  multiSelectionOn)
virtualslot

Set multi-selection.

◆ setNameFilter()

Q_INVOKABLE void qMRMLSubjectHierarchyTreeView::setNameFilter ( QString &  nameFilter)

Set name filter that allows showing only items containing a specified string (case-insensitive). Show all items if empty.

◆ setRootItem

virtual void qMRMLSubjectHierarchyTreeView::setRootItem ( vtkIdType  itemID)
virtualslot

Set subject hierarchy item to be the root in the shown tree.

◆ setShowRootItem

void qMRMLSubjectHierarchyTreeView::setShowRootItem ( bool  show)
slot

Set root item visibility.

◆ setSubjectHierarchyNode()

virtual void qMRMLSubjectHierarchyTreeView::setSubjectHierarchyNode ( vtkMRMLSubjectHierarchyNode shNode)
protectedvirtual

Set the subject hierarchy node found in the given scene. Called only internally.

◆ showContextMenuHint

bool qMRMLSubjectHierarchyTreeView::showContextMenuHint ( bool  visibility = false)
slot

Show hint to user about context menus

Parameters
visibilityTrue if visibility context menu hint is to be shown, false for general context menu. False by default
Returns
Flag indicating whether hint could be shown (i.e. there was an item in the tree is displayable)

◆ showRootItem()

bool qMRMLSubjectHierarchyTreeView::showRootItem ( ) const

Get root item visibility.

◆ sortFilterProxyModel()

Q_INVOKABLE qMRMLSortFilterSubjectHierarchyProxyModel* qMRMLSubjectHierarchyTreeView::sortFilterProxyModel ( ) const

◆ subjectHierarchyNode()

Q_INVOKABLE vtkMRMLSubjectHierarchyNode* qMRMLSubjectHierarchyTreeView::subjectHierarchyNode ( ) const

◆ toggleSubjectHierarchyItemVisibility()

void qMRMLSubjectHierarchyTreeView::toggleSubjectHierarchyItemVisibility ( vtkIdType  itemID)
protected

Toggle visibility for given subject hierarchy item.

◆ updateRootItem

virtual void qMRMLSubjectHierarchyTreeView::updateRootItem ( )
protectedvirtualslot

Update root item to restore view (e.g. after tree was updated in the model from the subject hierarchy)

◆ updateSelectPluginActions

virtual void qMRMLSubjectHierarchyTreeView::updateSelectPluginActions ( )
virtualslot

Update select plugin actions. Is called when the plugin selection sub-menu is opened, and when the user manually changes the owner plugin of a node. It sets checked state and update confidence values in the select plugin actions in the node context menu for the currently selected node.

Friends And Related Function Documentation

◆ qMRMLSubjectHierarchyComboBox

friend class qMRMLSubjectHierarchyComboBox
friend

Definition at line 229 of file qMRMLSubjectHierarchyTreeView.h.

Member Data Documentation

◆ d_ptr

QScopedPointer<qMRMLSubjectHierarchyTreeViewPrivate> qMRMLSubjectHierarchyTreeView::d_ptr
protected

Definition at line 224 of file qMRMLSubjectHierarchyTreeView.h.


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