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)
66 Q_PROPERTY(
int colorColumn READ colorColumn WRITE setColorColumn)
71 Q_PROPERTY (
int transformColumn READ transformColumn WRITE setTransformColumn)
74 Q_PROPERTY (
int descriptionColumn READ descriptionColumn WRITE setDescriptionColumn)
77 Q_PROPERTY (
int idColumn READ idColumn WRITE setIDColumn)
81 Q_PROPERTY(
bool noneEnabled READ noneEnabled WRITE setNoneEnabled)
85 Q_PROPERTY(QString noneDisplay READ noneDisplay WRITE setNoneDisplay)
95 SubjectHierarchyItemIDRole = Qt::UserRole + 1,
105 int nameColumn()
const;
106 void setNameColumn(
int column);
108 int visibilityColumn()
const;
109 void setVisibilityColumn(
int column);
111 int colorColumn()
const;
112 void setColorColumn(
int column);
114 int transformColumn()
const;
115 void setTransformColumn(
int column);
117 int descriptionColumn()
const;
118 void setDescriptionColumn(
int column);
121 void setIDColumn(
int column);
123 bool noneEnabled()
const;
124 void setNoneEnabled(
bool enable);
126 QString noneDisplay()
const;
127 void setNoneDisplay(
const QString& displayName);
129 Qt::DropActions supportedDropActions()
const override;
130 QMimeData* mimeData(
const QModelIndexList& indexes)
const override;
131 bool dropMimeData(
const QMimeData *data, Qt::DropAction action,
132 int row,
int column,
const QModelIndex &parent)
override;
134 Q_INVOKABLE
virtual void setMRMLScene(
vtkMRMLScene* scene);
140 QStandardItem* subjectHierarchySceneItem()
const;
142 QModelIndex subjectHierarchySceneIndex()
const;
143 virtual bool canBeAChild(vtkIdType itemID)
const;
144 virtual bool canBeAParent(vtkIdType itemID)
const;
146 vtkIdType subjectHierarchyItemFromIndex(
const QModelIndex &index)
const;
147 vtkIdType subjectHierarchyItemFromItem(QStandardItem* item)
const;
148 QModelIndex indexFromSubjectHierarchyItem(vtkIdType itemID,
int column=0)
const;
149 QStandardItem* itemFromSubjectHierarchyItem(vtkIdType itemID,
int column=0)
const;
152 QModelIndexList indexes(vtkIdType itemID)
const;
154 Q_INVOKABLE
virtual vtkIdType parentSubjectHierarchyItem(vtkIdType itemID)
const;
157 Q_INVOKABLE
virtual int subjectHierarchyItemIndex(vtkIdType itemID)
const;
159 Q_INVOKABLE
virtual bool reparent(vtkIdType itemID, vtkIdType newParentID);
161 Q_INVOKABLE
virtual bool moveToRow(vtkIdType itemID,
int newRow);
164 Q_INVOKABLE
bool isAncestorItem(vtkIdType child, vtkIdType ancestor)
const;
167 Q_INVOKABLE
bool isAffiliatedItem(vtkIdType itemA, vtkIdType itemB)
const;
171 void aboutToReparentByDragAndDrop(vtkIdType itemID, vtkIdType newParentID);
173 void reparentedByDragAndDrop(vtkIdType itemID, vtkIdType newParentID);
175 void subjectHierarchyAboutToBeUpdated();
177 void subjectHierarchyUpdated();
179 void requestExpandItem(vtkIdType itemID);
181 void requestCollapseItem(vtkIdType itemID);
185 void invalidateFilter();
189 void onRemoveTransformsFromBranchOfCurrentItem();
192 void onHardenTransformOnBranchOfCurrentItem();
195 virtual void onSubjectHierarchyItemAdded(vtkIdType itemID);
196 virtual void onSubjectHierarchyItemAboutToBeRemoved(vtkIdType itemID);
197 virtual void onSubjectHierarchyItemRemoved(vtkIdType itemID);
198 virtual void onSubjectHierarchyItemModified(vtkIdType itemID);
202 virtual void onMRMLSceneStartBatchProcess(
vtkMRMLScene* scene);
203 virtual void onMRMLSceneEndBatchProcess(
vtkMRMLScene* scene);
206 virtual void onItemChanged(QStandardItem* item);
207 virtual void delayedItemChanged();
211 void updateColumnCount();
221 virtual void rebuildFromSubjectHierarchy();
224 virtual void updateFromSubjectHierarchy();
226 virtual QStandardItem* insertSubjectHierarchyItem(vtkIdType itemID);
227 virtual QStandardItem* insertSubjectHierarchyItem(vtkIdType itemID, QStandardItem* parent,
int row=-1);
229 virtual QFlags<Qt::ItemFlag> subjectHierarchyItemFlags(vtkIdType itemID,
int column)
const;
231 virtual void updateItemFromSubjectHierarchyItem(
232 QStandardItem* item, vtkIdType shItemID,
int column );
233 virtual void updateItemDataFromSubjectHierarchyItem(
234 QStandardItem* item, vtkIdType shItemID,
int column );
235 virtual void updateSubjectHierarchyItemFromItem(
236 vtkIdType shItemID, QStandardItem* item );
237 virtual void updateSubjectHierarchyItemFromItemData(
238 vtkIdType shItemID, QStandardItem* item );
241 void updateModelItems(vtkIdType itemID);
243 static void onEvent(vtkObject* caller,
unsigned long event,
void* clientData,
void* callData);
246 virtual int maxColumnId()
const;
249 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.