21 #ifndef __qMRMLSceneModel_h 22 #define __qMRMLSceneModel_h 25 #include <QStandardItemModel> 29 #include <ctkVTKObject.h> 32 #include "qMRMLWidgetsExport.h" 37 class qMRMLSceneModelPrivate;
65 Q_PROPERTY (
NodeTypes listenNodeModifiedEvent READ listenNodeModifiedEvent WRITE setListenNodeModifiedEvent)
72 Q_PROPERTY (
bool lazyUpdate READ lazyUpdate WRITE setLazyUpdate)
78 Q_PROPERTY (
int nameColumn READ nameColumn WRITE setNameColumn)
83 Q_PROPERTY (
int idColumn READ idColumn WRITE setIDColumn)
86 Q_PROPERTY (
int checkableColumn READ checkableColumn WRITE setCheckableColumn)
89 Q_PROPERTY (
int visibilityColumn READ visibilityColumn WRITE setVisibilityColumn)
92 Q_PROPERTY (
int toolTipNameColumn READ toolTipNameColumn WRITE setToolTipNameColumn)
95 Q_PROPERTY(
int extraItemColumn READ extraItemColumn WRITE setExtraItemColumn)
110 UIDRole = Qt::UserRole + 1,
123 Q_INVOKABLE
virtual void setMRMLScene(
vtkMRMLScene* scene);
127 QStandardItem* mrmlSceneItem()
const;
130 QModelIndex mrmlSceneIndex()
const;
134 inline vtkMRMLNode* mrmlNodeFromIndex(
const QModelIndex &nodeIndex)
const;
135 vtkMRMLNode* mrmlNodeFromItem(QStandardItem* nodeItem)
const;
136 QModelIndex indexFromNode(
vtkMRMLNode* node,
int column = 0)
const;
138 QStandardItem* itemFromNode(
vtkMRMLNode* node,
int column = 0)
const;
146 void setListenNodeModifiedEvent(NodeTypes nodesToListen);
149 NodeTypes listenNodeModifiedEvent()
const;
151 bool lazyUpdate()
const;
152 void setLazyUpdate(
bool lazy);
154 int nameColumn()
const;
155 void setNameColumn(
int column);
158 void setIDColumn(
int column);
160 int checkableColumn()
const;
161 void setCheckableColumn(
int column);
163 int visibilityColumn()
const;
164 void setVisibilityColumn(
int column);
166 int toolTipNameColumn()
const;
167 void setToolTipNameColumn(
int column);
169 int extraItemColumn()
const;
170 void setExtraItemColumn(
int column);
174 void setPreItems(
const QStringList& extraItems, QStandardItem* parent);
175 QStringList preItems(QStandardItem* parent)
const;
179 void setPostItems(
const QStringList& extraItems, QStandardItem* parent);
180 QStringList postItems(QStandardItem* parent)
const;
184 virtual Qt::DropActions supportedDropActions()
const;
185 virtual QMimeData* mimeData(
const QModelIndexList& indexes)
const;
186 virtual bool dropMimeData(
const QMimeData *data, Qt::DropAction action,
187 int row,
int column,
const QModelIndex &parent);
227 virtual void onMRMLSceneAboutToBeImported(
vtkMRMLScene* scene);
229 virtual void onMRMLSceneAboutToBeClosed(
vtkMRMLScene* scene);
231 virtual void onMRMLSceneStartBatchProcess(
vtkMRMLScene* scene);
232 virtual void onMRMLSceneEndBatchProcess(
vtkMRMLScene* scene);
234 void onMRMLSceneDeleted(vtkObject* scene);
236 void onMRMLNodeModified(vtkObject* node);
239 void onMRMLNodeIDChanged(vtkObject* node,
void* callData);
240 virtual void onItemChanged(QStandardItem * item);
241 virtual void delayedItemChanged();
246 void updateColumnCount();
258 void sceneAboutToBeUpdated();
266 virtual void updateScene();
267 virtual void populateScene();
268 virtual QStandardItem* insertNode(
vtkMRMLNode* node);
269 virtual QStandardItem* insertNode(
vtkMRMLNode* node, QStandardItem* parent,
int row = -1);
271 virtual bool isANode(
const QStandardItem* item)
const;
272 virtual QFlags<Qt::ItemFlag> nodeFlags(
vtkMRMLNode* node,
int column)
const;
275 void updateNodeItems();
281 virtual void updateItemFromNode(QStandardItem* item,
vtkMRMLNode* node,
int column);
298 virtual void updateItemDataFromNode(QStandardItem* item,
vtkMRMLNode* node,
int column);
303 virtual void updateNodeFromItem(
vtkMRMLNode* node, QStandardItem* item);
319 virtual void updateNodeFromItemData(
vtkMRMLNode* node, QStandardItem* item);
322 void updateNodeItems(
vtkMRMLNode* node,
const QString& uid);
324 static void onMRMLSceneEvent(vtkObject* vtk_obj,
unsigned long event,
325 void* client_data,
void* call_data);
328 virtual int maxColumnId()
const;
330 QScopedPointer<qMRMLSceneModelPrivate>
d_ptr;
Pointer (as long long) of the item if it is a scene or a node.
virtual int nodeIndex(vtkMRMLNode *node) const
vtkMRMLNode * mrmlNodeFromItem(QStandardItem *nodeItem) const
QScopedPointer< qMRMLSceneModelPrivate > d_ptr
A set of MRML Nodes that supports serialization and undo/redo.
vtkMRMLNode * mrmlNodeFromIndex(const QModelIndex &nodeIndex) const
void printStandardItem(QStandardItem *item, const QString &offset)
Map (QMap<QString, QVariant>) for parent items of extra items.
Abstract Superclass for all specific types of MRML nodes.
QStandardItemModel Superclass