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 | Static Protected Member Functions | Protected Attributes
qMRMLSubjectHierarchyModel Class Reference

Item model for subject hierarchy. More...

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

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

Public Types

enum  ItemDataRole { SubjectHierarchyItemIDRole = Qt::UserRole + 1, VisibilityRole, TransformIDRole, LastRole }
 
typedef QStandardItemModel Superclass
 

Properties

int idColumn
 
int nameColumn
 
int transformColumn
 
int visibilityColumn
 

Public Slots

void onHardenTransformOnBranchOfCurrentItem ()
 Harden transform on branch of current item. More...
 
void onRemoveTransformsFromBranchOfCurrentItem ()
 Remove transforms from nodes in branch of current item. More...
 

Signals

void aboutToReparentByDragAndDrop (vtkIdType itemID, vtkIdType newParentID)
 This signal is sent when a user is about to reparent an item by drag and drop. More...
 
void invalidateFilter ()
 Triggers invalidating the sort filter proxy model. More...
 
void reparentedByDragAndDrop (vtkIdType itemID, vtkIdType newParentID)
 This signal is sent after a user dragged and dropped an item in the tree view. More...
 
void requestCollapseItem (vtkIdType itemID)
 Signal requesting collapsing of the subject hierarchy tree item belonging to an item. More...
 
void requestExpandItem (vtkIdType itemID)
 Signal requesting expanding of the subject hierarchy tree item belonging to an item. More...
 
void requestSelectItems (QList< vtkIdType > itemIDs)
 Signal requesting selecting items in the tree. More...
 
void subjectHierarchyAboutToBeUpdated ()
 This signal is sent when the whole subject hierarchy is about to be updated. More...
 
void subjectHierarchyUpdated ()
 This signal is sent after the whole subject hierarchy is updated. More...
 

Public Member Functions

virtual bool canBeAChild (vtkIdType itemID) const
 
virtual bool canBeAParent (vtkIdType itemID) const
 
virtual bool dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
 
int idColumn () const
 
QModelIndexList indexes (vtkIdType itemID) const
 Return all the QModelIndexes (all the columns) for a given subject hierarchy item. More...
 
QModelIndex indexFromSubjectHierarchyItem (vtkIdType itemID, int column=0) const
 
Q_INVOKABLE bool isAffiliatedItem (vtkIdType itemA, vtkIdType itemB) const
 
Q_INVOKABLE bool isAncestorItem (vtkIdType child, vtkIdType ancestor) const
 
QStandardItem * itemFromSubjectHierarchyItem (vtkIdType itemID, int column=0) const
 
virtual QMimeData * mimeData (const QModelIndexList &indexes) const
 
virtual Q_INVOKABLE bool moveToRow (vtkIdType itemID, int newRow)
 Move item in subject hierarchy branch to a new row (re-order) More...
 
Q_INVOKABLE vtkMRMLScenemrmlScene () const
 
int nameColumn () const
 
virtual Q_INVOKABLE vtkIdType parentSubjectHierarchyItem (vtkIdType itemID) const
 
 qMRMLSubjectHierarchyModel (QObject *parent=0)
 
virtual Q_INVOKABLE bool reparent (vtkIdType itemID, vtkIdType newParentID)
 Insert/move item in subject hierarchy under new parent. More...
 
void setIDColumn (int column)
 
virtual Q_INVOKABLE void setMRMLScene (vtkMRMLScene *scene)
 
void setNameColumn (int column)
 
void setTransformColumn (int column)
 
void setVisibilityColumn (int column)
 
vtkIdType subjectHierarchyItemFromIndex (const QModelIndex &index) const
 
vtkIdType subjectHierarchyItemFromItem (QStandardItem *item) const
 
virtual Q_INVOKABLE int subjectHierarchyItemIndex (vtkIdType itemID) const
 
vtkMRMLSubjectHierarchyNodesubjectHierarchyNode () const
 
QModelIndex subjectHierarchySceneIndex () const
 Invalid until a valid scene is set. More...
 
QStandardItem * subjectHierarchySceneItem () const
 NULL until a valid scene is set. More...
 
virtual Qt::DropActions supportedDropActions () const
 
int transformColumn () const
 
int visibilityColumn () const
 
virtual ~qMRMLSubjectHierarchyModel ()
 

Protected Slots

virtual void delayedItemChanged ()
 
virtual void onItemChanged (QStandardItem *item)
 
virtual void onMRMLNodeRemoved (vtkMRMLNode *node)
 
virtual void onMRMLSceneClosed (vtkMRMLScene *scene)
 
virtual void onMRMLSceneEndBatchProcess (vtkMRMLScene *scene)
 
virtual void onMRMLSceneImported (vtkMRMLScene *scene)
 
virtual void onMRMLSceneStartBatchProcess (vtkMRMLScene *scene)
 
virtual void onSubjectHierarchyItemAboutToBeRemoved (vtkIdType itemID)
 
virtual void onSubjectHierarchyItemAdded (vtkIdType itemID)
 
virtual void onSubjectHierarchyItemModified (vtkIdType itemID)
 
virtual void onSubjectHierarchyItemRemoved (vtkIdType itemID)
 
void updateColumnCount ()
 

Protected Member Functions

virtual QStandardItem * insertSubjectHierarchyItem (vtkIdType itemID)
 
virtual QStandardItem * insertSubjectHierarchyItem (vtkIdType itemID, QStandardItem *parent, int row=-1)
 
virtual int maxColumnId () const
 Must be reimplemented in subclasses that add new column types. More...
 
 qMRMLSubjectHierarchyModel (qMRMLSubjectHierarchyModelPrivate *pimpl, QObject *parent=0)
 
virtual void setSubjectHierarchyNode (vtkMRMLSubjectHierarchyNode *shNode)
 Set the subject hierarchy node found in the given scene. Called only internally. More...
 
virtual QFlags< Qt::ItemFlag > subjectHierarchyItemFlags (vtkIdType itemID, int column) const
 
virtual void updateFromSubjectHierarchy ()
 
virtual void updateItemDataFromSubjectHierarchyItem (QStandardItem *item, vtkIdType shItemID, int column)
 
virtual void updateItemFromSubjectHierarchyItem (QStandardItem *item, vtkIdType shItemID, int column)
 
void updateModelItems (vtkIdType itemID)
 Update the model items associated with the subject hierarchy item. More...
 
virtual void updateSubjectHierarchyItemFromItem (vtkIdType shItemID, QStandardItem *item)
 
virtual void updateSubjectHierarchyItemFromItemData (vtkIdType shItemID, QStandardItem *item)
 

Static Protected Member Functions

static void onEvent (vtkObject *caller, unsigned long event, void *clientData, void *callData)
 

Protected Attributes

QScopedPointer< qMRMLSubjectHierarchyModelPrivate > d_ptr
 

Detailed Description

Item model for subject hierarchy.

It is associated to the pseudo-singleton subject hierarchy node, and it creates one model item for each subject hierarchy item. It handles reparenting, reordering, etc. The whole model is regenerated when the Modified event is invoked on the subject hierarchy node, but only the individual items are updated when per-item events are invoked (such as vtkMRMLSubjectHierarchyNode::SubjectHierarchyItemModifiedEvent)

Definition at line 49 of file qMRMLSubjectHierarchyModel.h.

Member Typedef Documentation

◆ Superclass

typedef QStandardItemModel qMRMLSubjectHierarchyModel::Superclass

Definition at line 74 of file qMRMLSubjectHierarchyModel.h.

Member Enumeration Documentation

◆ ItemDataRole

Enumerator
SubjectHierarchyItemIDRole 

Unique ID of the item, typed vtkIdType.

VisibilityRole 

Integer that contains the visibility property of an item. It is closely related to the item icon.

TransformIDRole 

MRML node ID of the parent transform.

LastRole 

Must stay the last enum in the list.

Definition at line 78 of file qMRMLSubjectHierarchyModel.h.

Property Documentation

◆ idColumn

int qMRMLSubjectHierarchyModel::idColumn
readwrite

Control in which column the data MRML node IDs are displayed (Qt::DisplayRole). A value of -1 hides it. Hidden by default (value of -1)

Definition at line 71 of file qMRMLSubjectHierarchyModel.h.

◆ nameColumn

int qMRMLSubjectHierarchyModel::nameColumn
readwrite

Control in which column the data MRML node names or if not assigned then subject hierarchy item names are displayed (Qt::DisplayRole). The icons corresponding to the role provided by the owner subject hierarchy plugin is also displayed in this column (Qt::DecorationRole). A value of -1 hides it. First column (0) by default. If no property is set in a column, nothing is displayed.

Definition at line 60 of file qMRMLSubjectHierarchyModel.h.

◆ transformColumn

int qMRMLSubjectHierarchyModel::transformColumn
readwrite

Control in which column the parent transforms are displayed A MRML node combobox is displayed in the row of the transformable nodes, in which the current transform is selected. The user can change the transform using the combobox. A value of -1 (default) hides the column

Definition at line 68 of file qMRMLSubjectHierarchyModel.h.

◆ visibilityColumn

int qMRMLSubjectHierarchyModel::visibilityColumn
readwrite

Control in which column data MRML node visibility are displayed (Qt::DecorationRole). A value of -1 hides it. Hidden by default (value of -1).

Definition at line 63 of file qMRMLSubjectHierarchyModel.h.

Constructor & Destructor Documentation

◆ qMRMLSubjectHierarchyModel() [1/2]

qMRMLSubjectHierarchyModel::qMRMLSubjectHierarchyModel ( QObject *  parent = 0)

◆ ~qMRMLSubjectHierarchyModel()

virtual qMRMLSubjectHierarchyModel::~qMRMLSubjectHierarchyModel ( )
virtual

◆ qMRMLSubjectHierarchyModel() [2/2]

qMRMLSubjectHierarchyModel::qMRMLSubjectHierarchyModel ( qMRMLSubjectHierarchyModelPrivate *  pimpl,
QObject *  parent = 0 
)
protected

Member Function Documentation

◆ aboutToReparentByDragAndDrop

void qMRMLSubjectHierarchyModel::aboutToReparentByDragAndDrop ( vtkIdType  itemID,
vtkIdType  newParentID 
)
signal

This signal is sent when a user is about to reparent an item by drag and drop.

◆ canBeAChild()

virtual bool qMRMLSubjectHierarchyModel::canBeAChild ( vtkIdType  itemID) const
virtual

◆ canBeAParent()

virtual bool qMRMLSubjectHierarchyModel::canBeAParent ( vtkIdType  itemID) const
virtual

◆ delayedItemChanged

virtual void qMRMLSubjectHierarchyModel::delayedItemChanged ( )
protectedvirtualslot

◆ dropMimeData()

virtual bool qMRMLSubjectHierarchyModel::dropMimeData ( const QMimeData *  data,
Qt::DropAction  action,
int  row,
int  column,
const QModelIndex &  parent 
)
virtual

◆ idColumn()

int qMRMLSubjectHierarchyModel::idColumn ( ) const

◆ indexes()

QModelIndexList qMRMLSubjectHierarchyModel::indexes ( vtkIdType  itemID) const

Return all the QModelIndexes (all the columns) for a given subject hierarchy item.

◆ indexFromSubjectHierarchyItem()

QModelIndex qMRMLSubjectHierarchyModel::indexFromSubjectHierarchyItem ( vtkIdType  itemID,
int  column = 0 
) const

◆ insertSubjectHierarchyItem() [1/2]

virtual QStandardItem* qMRMLSubjectHierarchyModel::insertSubjectHierarchyItem ( vtkIdType  itemID)
protectedvirtual

◆ insertSubjectHierarchyItem() [2/2]

virtual QStandardItem* qMRMLSubjectHierarchyModel::insertSubjectHierarchyItem ( vtkIdType  itemID,
QStandardItem *  parent,
int  row = -1 
)
protectedvirtual

◆ invalidateFilter

void qMRMLSubjectHierarchyModel::invalidateFilter ( )
signal

Triggers invalidating the sort filter proxy model.

◆ isAffiliatedItem()

Q_INVOKABLE bool qMRMLSubjectHierarchyModel::isAffiliatedItem ( vtkIdType  itemA,
vtkIdType  itemB 
) const

Utility method that returns true if 2 nodes are child/parent (or any ancestor) for each other

See also
isAncestorItem()

◆ isAncestorItem()

Q_INVOKABLE bool qMRMLSubjectHierarchyModel::isAncestorItem ( vtkIdType  child,
vtkIdType  ancestor 
) const

Utility method that returns true if child has parent as ancestor (parent, grandparent, etc.)

See also
isAffiliatedItem()

◆ itemFromSubjectHierarchyItem()

QStandardItem* qMRMLSubjectHierarchyModel::itemFromSubjectHierarchyItem ( vtkIdType  itemID,
int  column = 0 
) const

◆ maxColumnId()

virtual int qMRMLSubjectHierarchyModel::maxColumnId ( ) const
protectedvirtual

Must be reimplemented in subclasses that add new column types.

◆ mimeData()

virtual QMimeData* qMRMLSubjectHierarchyModel::mimeData ( const QModelIndexList &  indexes) const
virtual

◆ moveToRow()

virtual Q_INVOKABLE bool qMRMLSubjectHierarchyModel::moveToRow ( vtkIdType  itemID,
int  newRow 
)
virtual

Move item in subject hierarchy branch to a new row (re-order)

◆ mrmlScene()

Q_INVOKABLE vtkMRMLScene* qMRMLSubjectHierarchyModel::mrmlScene ( ) const

◆ nameColumn()

int qMRMLSubjectHierarchyModel::nameColumn ( ) const

◆ onEvent()

static void qMRMLSubjectHierarchyModel::onEvent ( vtkObject *  caller,
unsigned long  event,
void *  clientData,
void *  callData 
)
staticprotected

◆ onHardenTransformOnBranchOfCurrentItem

void qMRMLSubjectHierarchyModel::onHardenTransformOnBranchOfCurrentItem ( )
slot

Harden transform on branch of current item.

◆ onItemChanged

virtual void qMRMLSubjectHierarchyModel::onItemChanged ( QStandardItem *  item)
protectedvirtualslot

◆ onMRMLNodeRemoved

virtual void qMRMLSubjectHierarchyModel::onMRMLNodeRemoved ( vtkMRMLNode node)
protectedvirtualslot

◆ onMRMLSceneClosed

virtual void qMRMLSubjectHierarchyModel::onMRMLSceneClosed ( vtkMRMLScene scene)
protectedvirtualslot

◆ onMRMLSceneEndBatchProcess

virtual void qMRMLSubjectHierarchyModel::onMRMLSceneEndBatchProcess ( vtkMRMLScene scene)
protectedvirtualslot

◆ onMRMLSceneImported

virtual void qMRMLSubjectHierarchyModel::onMRMLSceneImported ( vtkMRMLScene scene)
protectedvirtualslot

◆ onMRMLSceneStartBatchProcess

virtual void qMRMLSubjectHierarchyModel::onMRMLSceneStartBatchProcess ( vtkMRMLScene scene)
protectedvirtualslot

◆ onRemoveTransformsFromBranchOfCurrentItem

void qMRMLSubjectHierarchyModel::onRemoveTransformsFromBranchOfCurrentItem ( )
slot

Remove transforms from nodes in branch of current item.

◆ onSubjectHierarchyItemAboutToBeRemoved

virtual void qMRMLSubjectHierarchyModel::onSubjectHierarchyItemAboutToBeRemoved ( vtkIdType  itemID)
protectedvirtualslot

◆ onSubjectHierarchyItemAdded

virtual void qMRMLSubjectHierarchyModel::onSubjectHierarchyItemAdded ( vtkIdType  itemID)
protectedvirtualslot

◆ onSubjectHierarchyItemModified

virtual void qMRMLSubjectHierarchyModel::onSubjectHierarchyItemModified ( vtkIdType  itemID)
protectedvirtualslot

◆ onSubjectHierarchyItemRemoved

virtual void qMRMLSubjectHierarchyModel::onSubjectHierarchyItemRemoved ( vtkIdType  itemID)
protectedvirtualslot

◆ parentSubjectHierarchyItem()

virtual Q_INVOKABLE vtkIdType qMRMLSubjectHierarchyModel::parentSubjectHierarchyItem ( vtkIdType  itemID) const
virtual

◆ reparent()

virtual Q_INVOKABLE bool qMRMLSubjectHierarchyModel::reparent ( vtkIdType  itemID,
vtkIdType  newParentID 
)
virtual

Insert/move item in subject hierarchy under new parent.

◆ reparentedByDragAndDrop

void qMRMLSubjectHierarchyModel::reparentedByDragAndDrop ( vtkIdType  itemID,
vtkIdType  newParentID 
)
signal

This signal is sent after a user dragged and dropped an item in the tree view.

◆ requestCollapseItem

void qMRMLSubjectHierarchyModel::requestCollapseItem ( vtkIdType  itemID)
signal

Signal requesting collapsing of the subject hierarchy tree item belonging to an item.

◆ requestExpandItem

void qMRMLSubjectHierarchyModel::requestExpandItem ( vtkIdType  itemID)
signal

Signal requesting expanding of the subject hierarchy tree item belonging to an item.

◆ requestSelectItems

void qMRMLSubjectHierarchyModel::requestSelectItems ( QList< vtkIdType >  itemIDs)
signal

Signal requesting selecting items in the tree.

◆ setIDColumn()

void qMRMLSubjectHierarchyModel::setIDColumn ( int  column)

◆ setMRMLScene()

virtual Q_INVOKABLE void qMRMLSubjectHierarchyModel::setMRMLScene ( vtkMRMLScene scene)
virtual

◆ setNameColumn()

void qMRMLSubjectHierarchyModel::setNameColumn ( int  column)

◆ setSubjectHierarchyNode()

virtual void qMRMLSubjectHierarchyModel::setSubjectHierarchyNode ( vtkMRMLSubjectHierarchyNode shNode)
protectedvirtual

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

◆ setTransformColumn()

void qMRMLSubjectHierarchyModel::setTransformColumn ( int  column)

◆ setVisibilityColumn()

void qMRMLSubjectHierarchyModel::setVisibilityColumn ( int  column)

◆ subjectHierarchyAboutToBeUpdated

void qMRMLSubjectHierarchyModel::subjectHierarchyAboutToBeUpdated ( )
signal

This signal is sent when the whole subject hierarchy is about to be updated.

◆ subjectHierarchyItemFlags()

virtual QFlags<Qt::ItemFlag> qMRMLSubjectHierarchyModel::subjectHierarchyItemFlags ( vtkIdType  itemID,
int  column 
) const
protectedvirtual

◆ subjectHierarchyItemFromIndex()

vtkIdType qMRMLSubjectHierarchyModel::subjectHierarchyItemFromIndex ( const QModelIndex &  index) const

◆ subjectHierarchyItemFromItem()

vtkIdType qMRMLSubjectHierarchyModel::subjectHierarchyItemFromItem ( QStandardItem *  item) const

◆ subjectHierarchyItemIndex()

virtual Q_INVOKABLE int qMRMLSubjectHierarchyModel::subjectHierarchyItemIndex ( vtkIdType  itemID) const
virtual

Returns the row model index relative to its parent independently of any filtering or proxy model Must be reimplemented in derived classes

◆ subjectHierarchyNode()

vtkMRMLSubjectHierarchyNode* qMRMLSubjectHierarchyModel::subjectHierarchyNode ( ) const

◆ subjectHierarchySceneIndex()

QModelIndex qMRMLSubjectHierarchyModel::subjectHierarchySceneIndex ( ) const

Invalid until a valid scene is set.

◆ subjectHierarchySceneItem()

QStandardItem* qMRMLSubjectHierarchyModel::subjectHierarchySceneItem ( ) const

NULL until a valid scene is set.

◆ subjectHierarchyUpdated

void qMRMLSubjectHierarchyModel::subjectHierarchyUpdated ( )
signal

This signal is sent after the whole subject hierarchy is updated.

◆ supportedDropActions()

virtual Qt::DropActions qMRMLSubjectHierarchyModel::supportedDropActions ( ) const
virtual

◆ transformColumn()

int qMRMLSubjectHierarchyModel::transformColumn ( ) const

◆ updateColumnCount

void qMRMLSubjectHierarchyModel::updateColumnCount ( )
protectedslot

Recompute the number of columns in the model. Called when a [some]Column property is set. Needs maxColumnId() to be reimplemented in subclasses

◆ updateFromSubjectHierarchy()

virtual void qMRMLSubjectHierarchyModel::updateFromSubjectHierarchy ( )
protectedvirtual

◆ updateItemDataFromSubjectHierarchyItem()

virtual void qMRMLSubjectHierarchyModel::updateItemDataFromSubjectHierarchyItem ( QStandardItem *  item,
vtkIdType  shItemID,
int  column 
)
protectedvirtual

◆ updateItemFromSubjectHierarchyItem()

virtual void qMRMLSubjectHierarchyModel::updateItemFromSubjectHierarchyItem ( QStandardItem *  item,
vtkIdType  shItemID,
int  column 
)
protectedvirtual

◆ updateModelItems()

void qMRMLSubjectHierarchyModel::updateModelItems ( vtkIdType  itemID)
protected

Update the model items associated with the subject hierarchy item.

◆ updateSubjectHierarchyItemFromItem()

virtual void qMRMLSubjectHierarchyModel::updateSubjectHierarchyItemFromItem ( vtkIdType  shItemID,
QStandardItem *  item 
)
protectedvirtual

◆ updateSubjectHierarchyItemFromItemData()

virtual void qMRMLSubjectHierarchyModel::updateSubjectHierarchyItemFromItemData ( vtkIdType  shItemID,
QStandardItem *  item 
)
protectedvirtual

◆ visibilityColumn()

int qMRMLSubjectHierarchyModel::visibilityColumn ( ) const

Member Data Documentation

◆ d_ptr

QScopedPointer<qMRMLSubjectHierarchyModelPrivate> qMRMLSubjectHierarchyModel::d_ptr
protected

Definition at line 217 of file qMRMLSubjectHierarchyModel.h.


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