21#ifndef __qMRMLSceneModel_h
22#define __qMRMLSceneModel_h
25#include <QStandardItemModel>
29#include <ctkVTKObject.h>
32#include "qMRMLWidgetsExport.h"
37class qMRMLSceneModelPrivate;
174 void setPreItems(
const QStringList& extraItems, QStandardItem* parent);
179 void setPostItems(
const QStringList& extraItems, QStandardItem* parent);
187 int row,
int column,
const QModelIndex &parent)
override;
271 virtual bool isANode(
const QStandardItem* item)
const;
325 void* client_data,
void* call_data);
330 QScopedPointer<qMRMLSceneModelPrivate>
d_ptr;
virtual bool canBeAChild(vtkMRMLNode *node) const
fast function that only check the type of the node to know if it can be a child.
virtual QFlags< Qt::ItemFlag > nodeFlags(vtkMRMLNode *node, int column) const
void sceneUpdated()
This signal is sent after the scene is updated.
virtual void onMRMLSceneNodeAboutToBeAdded(vtkMRMLScene *scene, vtkMRMLNode *node)
NodeTypes listenNodeModifiedEvent() const
virtual void observeNode(vtkMRMLNode *node)
QScopedPointer< qMRMLSceneModelPrivate > d_ptr
@ LastRole
Must stay the last enum in the list.
@ ExtraItemsRole
Map (QMap<QString, QVariant>) for parent items of extra items.
@ PointerRole
Pointer (as long long) of the item if it is a scene or a node.
@ UIDRole
Unique ID of the item. For nodes, it is the node ID.
virtual void populateScene()
void setExtraItemColumn(int column)
virtual void onMRMLSceneStartBatchProcess(vtkMRMLScene *scene)
virtual bool canBeAParent(vtkMRMLNode *node) const
qMRMLSceneModel(qMRMLSceneModelPrivate *pimpl, QObject *parent=nullptr)
virtual bool reparent(vtkMRMLNode *node, vtkMRMLNode *newParent)
QStringList postItems(QStandardItem *parent) const
void updateNodeItems()
You shouldn't need to call this function.
QModelIndexList indexes(vtkMRMLNode *node) const
virtual void onMRMLSceneAboutToBeImported(vtkMRMLScene *scene)
void setPostItems(const QStringList &extraItems, QStandardItem *parent)
virtual void onItemChanged(QStandardItem *item)
virtual void onMRMLSceneImported(vtkMRMLScene *scene)
virtual void updateItemFromNode(QStandardItem *item, vtkMRMLNode *node, int column)
int toolTipNameColumn() const
vtkMRMLNode * mrmlNodeFromItem(QStandardItem *nodeItem) const
void reparentedByDragAndDrop(vtkMRMLNode *node, vtkMRMLNode *newParent)
void setIDColumn(int column)
static void onMRMLSceneEvent(vtkObject *vtk_obj, unsigned long event, void *client_data, void *call_data)
bool isParentNode(vtkMRMLNode *child, vtkMRMLNode *parent) const
void aboutToReparentByDragAndDrop(vtkMRMLNode *node, vtkMRMLNode *newParent)
qMRMLSceneModel(QObject *parent=nullptr)
int visibilityColumn() const
virtual int nodeIndex(vtkMRMLNode *node) const
virtual void onMRMLSceneNodeRemoved(vtkMRMLScene *scene, vtkMRMLNode *node)
void onMRMLSceneDeleted(vtkMRMLScene *scene)
virtual bool isANode(const QStandardItem *item) const
virtual void onMRMLSceneAboutToBeClosed(vtkMRMLScene *scene)
virtual void delayedItemChanged()
QModelIndex indexFromNode(vtkMRMLNode *node, int column=0) const
void sceneAboutToBeUpdated()
This signal is sent when the scene is about to be updated.
QStandardItem * mrmlSceneItem() const
0 until a valid scene is set
bool isAffiliatedNode(vtkMRMLNode *nodeA, vtkMRMLNode *nodeB) const
vtkMRMLNode * mrmlNodeFromIndex(const QModelIndex &nodeIndex) const
virtual vtkMRMLNode * parentNode(vtkMRMLNode *node) const
QStandardItemModel Superclass
Qt::DropActions supportedDropActions() const override
void setLazyUpdate(bool lazy)
void setPreItems(const QStringList &extraItems, QStandardItem *parent)
virtual void updateNodeFromItemData(vtkMRMLNode *node, QStandardItem *item)
QStandardItem * itemFromNode(vtkMRMLNode *node, int column=0) const
QVTK_OBJECT NodeTypes listenNodeModifiedEvent
virtual Q_INVOKABLE void setMRMLScene(vtkMRMLScene *scene)
0 by default
void setNameColumn(int column)
virtual void onMRMLSceneNodeAboutToBeRemoved(vtkMRMLScene *scene, vtkMRMLNode *node)
virtual void onMRMLSceneClosed(vtkMRMLScene *scene)
virtual void onMRMLSceneNodeAdded(vtkMRMLScene *scene, vtkMRMLNode *node)
virtual void onMRMLSceneEndBatchProcess(vtkMRMLScene *scene)
virtual void updateScene()
virtual QStandardItem * insertNode(vtkMRMLNode *node)
void setListenNodeModifiedEvent(NodeTypes nodesToListen)
void onMRMLNodeIDChanged(vtkObject *node, void *callData)
QStringList preItems(QStandardItem *parent) const
virtual int maxColumnId() const
Must be reimplemented in subclasses that add new column types.
void updateNodeItems(vtkMRMLNode *node, const QString &uid)
Update the items associated with the node and UID.
QModelIndex mrmlSceneIndex() const
invalid until a valid scene is set
void setVisibilityColumn(int column)
virtual void updateNodeFromItem(vtkMRMLNode *node, QStandardItem *item)
int extraItemColumn() const
virtual QStandardItem * insertNode(vtkMRMLNode *node, QStandardItem *parent, int row=-1)
int checkableColumn() const
virtual void updateItemDataFromNode(QStandardItem *item, vtkMRMLNode *node, int column)
void setCheckableColumn(int column)
void setToolTipNameColumn(int column)
void onMRMLNodeModified(vtkObject *node)
QMimeData * mimeData(const QModelIndexList &indexes) const override
Q_INVOKABLE vtkMRMLScene * mrmlScene() const
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override
Abstract Superclass for all specific types of MRML nodes.
A set of MRML Nodes that supports serialization and undo/redo.
void printStandardItem(QStandardItem *item, const QString &offset)
Q_DECLARE_METATYPE(qSlicerExtensionsManagerModel::ServerAPI)