23 #ifndef __qMRMLSubjectHierarchyModel_h 24 #define __qMRMLSubjectHierarchyModel_h 27 #include <QStandardItemModel> 31 #include <ctkVTKObject.h> 34 #include "qSlicerSubjectHierarchyModuleWidgetsExport.h" 36 class qMRMLSubjectHierarchyModelPrivate;
60 Q_PROPERTY (
int nameColumn READ nameColumn WRITE setNameColumn)
63 Q_PROPERTY (
int visibilityColumn READ visibilityColumn WRITE setVisibilityColumn)
68 Q_PROPERTY (
int transformColumn READ transformColumn WRITE setTransformColumn)
71 Q_PROPERTY (
int idColumn READ idColumn WRITE setIDColumn)
81 SubjectHierarchyItemIDRole = Qt::UserRole + 1,
91 int nameColumn()
const;
92 void setNameColumn(
int column);
94 int visibilityColumn()
const;
95 void setVisibilityColumn(
int column);
97 int transformColumn()
const;
98 void setTransformColumn(
int column);
101 void setIDColumn(
int column);
103 virtual Qt::DropActions supportedDropActions()
const;
104 virtual QMimeData* mimeData(
const QModelIndexList& indexes)
const;
105 virtual bool dropMimeData(
const QMimeData *data, Qt::DropAction action,
106 int row,
int column,
const QModelIndex &parent);
108 Q_INVOKABLE
virtual void setMRMLScene(
vtkMRMLScene* scene);
114 QStandardItem* subjectHierarchySceneItem()
const;
116 QModelIndex subjectHierarchySceneIndex()
const;
117 virtual bool canBeAChild(vtkIdType itemID)
const;
118 virtual bool canBeAParent(vtkIdType itemID)
const;
120 vtkIdType subjectHierarchyItemFromIndex(
const QModelIndex &index)
const;
121 vtkIdType subjectHierarchyItemFromItem(QStandardItem* item)
const;
122 QModelIndex indexFromSubjectHierarchyItem(vtkIdType itemID,
int column=0)
const;
123 QStandardItem* itemFromSubjectHierarchyItem(vtkIdType itemID,
int column=0)
const;
126 QModelIndexList indexes(vtkIdType itemID)
const;
128 Q_INVOKABLE
virtual vtkIdType parentSubjectHierarchyItem(vtkIdType itemID)
const;
131 Q_INVOKABLE
virtual int subjectHierarchyItemIndex(vtkIdType itemID)
const;
133 Q_INVOKABLE
virtual bool reparent(vtkIdType itemID, vtkIdType newParentID);
135 Q_INVOKABLE
virtual bool moveToRow(vtkIdType itemID,
int newRow);
138 Q_INVOKABLE
bool isAncestorItem(vtkIdType child, vtkIdType ancestor)
const;
141 Q_INVOKABLE
bool isAffiliatedItem(vtkIdType itemA, vtkIdType itemB)
const;
145 void aboutToReparentByDragAndDrop(vtkIdType itemID, vtkIdType newParentID);
147 void reparentedByDragAndDrop(vtkIdType itemID, vtkIdType newParentID);
149 void subjectHierarchyAboutToBeUpdated();
151 void subjectHierarchyUpdated();
153 void requestExpandItem(vtkIdType itemID);
155 void requestCollapseItem(vtkIdType itemID);
159 void invalidateFilter();
163 void onRemoveTransformsFromBranchOfCurrentItem();
166 void onHardenTransformOnBranchOfCurrentItem();
169 virtual void onSubjectHierarchyItemAdded(vtkIdType itemID);
170 virtual void onSubjectHierarchyItemAboutToBeRemoved(vtkIdType itemID);
171 virtual void onSubjectHierarchyItemRemoved(vtkIdType itemID);
172 virtual void onSubjectHierarchyItemModified(vtkIdType itemID);
176 virtual void onMRMLSceneStartBatchProcess(
vtkMRMLScene* scene);
177 virtual void onMRMLSceneEndBatchProcess(
vtkMRMLScene* scene);
180 virtual void onItemChanged(QStandardItem* item);
181 virtual void delayedItemChanged();
185 void updateColumnCount();
193 virtual void updateFromSubjectHierarchy();
194 virtual QStandardItem* insertSubjectHierarchyItem(vtkIdType itemID);
195 virtual QStandardItem* insertSubjectHierarchyItem(vtkIdType itemID, QStandardItem* parent,
int row=-1);
197 virtual QFlags<Qt::ItemFlag> subjectHierarchyItemFlags(vtkIdType itemID,
int column)
const;
199 virtual void updateItemFromSubjectHierarchyItem(
200 QStandardItem* item, vtkIdType shItemID,
int column );
201 virtual void updateItemDataFromSubjectHierarchyItem(
202 QStandardItem* item, vtkIdType shItemID,
int column );
203 virtual void updateSubjectHierarchyItemFromItem(
204 vtkIdType shItemID, QStandardItem* item );
205 virtual void updateSubjectHierarchyItemFromItemData(
206 vtkIdType shItemID, QStandardItem* item );
209 void updateModelItems(vtkIdType itemID);
211 static void onEvent(vtkObject* caller,
unsigned long event,
void* clientData,
void* callData);
214 virtual int maxColumnId()
const;
217 QScopedPointer<qMRMLSubjectHierarchyModelPrivate>
d_ptr;
QScopedPointer< qMRMLSubjectHierarchyModelPrivate > d_ptr
MRML node ID of the parent transform.
void printStandardItem(QStandardItem *item, const QString &offset)
MRML node to represent a complete subject hierarchy tree.
QStandardItemModel Superclass
A set of MRML Nodes that supports serialization and undo/redo.
Item model for subject hierarchy.
Abstract Superclass for all specific types of MRML nodes.