Medical Imaging Interaction Toolkit
2016.11.0
Medical Imaging Interaction Toolkit
|
#include <QmitkDataStorageTreeModel.h>
Classes | |
class | TreeItem |
Public Member Functions | |
QmitkDataStorageTreeModel (mitk::DataStorage *_DataStorage, bool _PlaceNewNodesOnTop=false, QObject *parent=0) | |
~QmitkDataStorageTreeModel () | |
mitk::DataNode::Pointer | GetNode (const QModelIndex &index) const |
virtual QList< mitk::DataNode::Pointer > | GetNodeSet () const |
const mitk::DataStorage::Pointer | GetDataStorage () const |
bool | GetPlaceNewNodesOnTopFlag () |
void | SetPlaceNewNodesOnTop (bool _PlaceNewNodesOnTop) |
Qt::ItemFlags | flags (const QModelIndex &index) const override |
QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const override |
QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override |
int | rowCount (const QModelIndex &parent=QModelIndex()) const override |
int | columnCount (const QModelIndex &parent=QModelIndex()) const override |
QModelIndex | index (int row, int column, const QModelIndex &parent=QModelIndex()) const override |
QModelIndex | parent (const QModelIndex &index) const override |
bool | setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override |
bool | setHeaderData (int section, Qt::Orientation orientation, const QVariant &value, int role=Qt::EditRole) override |
bool | dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override |
Qt::DropActions | supportedDropActions () const override |
Qt::DropActions | supportedDragActions () const override |
QStringList | mimeTypes () const override |
QMimeData * | mimeData (const QModelIndexList &indexes) const override |
void | SetDataStorage (mitk::DataStorage *_DataStorage) |
void | SetDataStorageDeleted (const itk::Object *_DataStorage) |
virtual void | AddNode (const mitk::DataNode *node) |
virtual void | RemoveNode (const mitk::DataNode *node) |
virtual void | SetNodeModified (const mitk::DataNode *node) |
QModelIndex | GetIndex (const mitk::DataNode *) const |
void | SetAllowHierarchyChange (bool allowHierarchyChange) |
Set whether to allow hierarchy changes by dragging and dropping. More... | |
Static Public Member Functions | |
static QMimeData * | mimeDataFromModelIndexList (const QModelIndexList &indexes) |
Static Public Attributes | |
static const std::string | COLUMN_NAME |
static const std::string | COLUMN_TYPE |
static const std::string | COLUMN_VISIBILITY |
Protected Member Functions | |
QList< TreeItem * > | ToTreeItemPtrList (const QMimeData *mimeData) |
QList< TreeItem * > | ToTreeItemPtrList (const QByteArray &ba) |
void | AdjustLayerProperty () |
TreeItem * | TreeItemFromIndex (const QModelIndex &index) const |
QModelIndex | IndexFromTreeItem (TreeItem *) const |
mitk::DataNode * | GetParentNode (const mitk::DataNode *node) const |
void | TreeToVector (TreeItem *parent, std::vector< TreeItem * > &vec) const |
void | TreeToNodeSet (TreeItem *parent, QList< mitk::DataNode::Pointer > &vec) const |
void | Update () |
Protected Attributes | |
mitk::WeakPointer< mitk::DataStorage > | m_DataStorage |
mitk::NodePredicateBase::Pointer | m_Predicate |
bool | m_PlaceNewNodesOnTop |
TreeItem * | m_Root |
bool | m_BlockDataStorageEvents |
Flag to block the data storage events if nodes are added/removed by this class. More... | |
bool | m_AllowHierarchyChange |
Definition at line 36 of file QmitkDataStorageTreeModel.h.
QmitkDataStorageTreeModel::QmitkDataStorageTreeModel | ( | mitk::DataStorage * | _DataStorage, |
bool | _PlaceNewNodesOnTop = false , |
||
QObject * | parent = 0 |
||
) |
Definition at line 44 of file QmitkDataStorageTreeModel.cpp.
References SetDataStorage().
QmitkDataStorageTreeModel::~QmitkDataStorageTreeModel | ( | ) |
Definition at line 57 of file QmitkDataStorageTreeModel.cpp.
References QmitkDataStorageTreeModel::TreeItem::Delete(), m_Root, and SetDataStorage().
|
virtual |
Adds a node to this model. If a predicate is set (not null) the node will be checked against it.The node has to have a data object (no one wants to see empty nodes).
Definition at line 649 of file QmitkDataStorageTreeModel.cpp.
References mitk::DataStorage::Exists(), QmitkDataStorageTreeModel::TreeItem::Find(), mitk::WeakPointer< TObjectType >::IsNull(), m_BlockDataStorageEvents, m_DataStorage, and m_Root.
Referenced by SetDataStorage().
|
protected |
Adjusts the LayerProperty according to the nodes position
transform the tree into an array and set the layer property descending
Definition at line 776 of file QmitkDataStorageTreeModel.cpp.
References mitk::RenderingManager::GetInstance(), m_Root, mitk::RenderingManager::RequestUpdateAll(), and TreeToVector().
Referenced by dropMimeData().
|
override |
Definition at line 116 of file QmitkDataStorageTreeModel.cpp.
|
override |
Code coveres the deprecated property naming for backwards compatibility
Definition at line 428 of file QmitkDataStorageTreeModel.cpp.
References mitk::GeneratePropertyNameForDICOMTag(), QmitkDataStorageTreeModel::TreeItem::GetDataNode(), QmitkNodeDescriptorManager::GetDescriptor(), QmitkNodeDescriptor::GetIcon(), QmitkNodeDescriptorManager::GetInstance(), mitk::DataNode::GetName(), mitk::DataNode::GetProperty(), mitk::BaseProperty::GetValueAsString(), mitk::DataNode::IsVisible(), QmitkDataNodeRawPointerRole, QmitkDataNodeRole, and TreeItemFromIndex().
|
override |
Definition at line 152 of file QmitkDataStorageTreeModel.cpp.
References mitk::DataStorage::Add(), AdjustLayerProperty(), mitk::DataStorage::Exists(), QmitkDataStorageTreeModel::TreeItem::GetChildCount(), mitk::DataNode::GetData(), QmitkDataStorageTreeModel::TreeItem::GetDataNode(), QmitkDataStorageTreeModel::TreeItem::GetIndex(), mitk::RenderingManager::GetInstance(), QmitkDataStorageTreeModel::TreeItem::GetParent(), IndexFromTreeItem(), mitk::RenderingManager::InitializeViews(), QmitkDataStorageTreeModel::TreeItem::InsertChild(), mitk::WeakPointer< TObjectType >::IsNotNull(), m_AllowHierarchyChange, m_BlockDataStorageEvents, m_DataStorage, m_Root, min(), mitk::DataStorage::Remove(), QmitkDataStorageTreeModel::TreeItem::RemoveChild(), mitk::RenderingManager::REQUEST_UPDATE_ALL, mitk::RenderingManager::RequestUpdateAll(), QmitkMimeTypes::ToDataNodePtrList(), ToTreeItemPtrList(), and TreeItemFromIndex().
|
override |
Definition at line 97 of file QmitkDataStorageTreeModel.cpp.
References QmitkDataStorageTreeModel::TreeItem::GetDataNode(), and TreeItemFromIndex().
const mitk::DataStorage::Pointer QmitkDataStorageTreeModel::GetDataStorage | ( | ) | const |
Get the DataStorage.
Definition at line 70 of file QmitkDataStorageTreeModel.cpp.
References mitk::WeakPointer< TObjectType >::GetPointer(), and m_DataStorage.
QModelIndex QmitkDataStorageTreeModel::GetIndex | ( | const mitk::DataNode * | node | ) | const |
Definition at line 835 of file QmitkDataStorageTreeModel.cpp.
References QmitkDataStorageTreeModel::TreeItem::Find(), IndexFromTreeItem(), and m_Root.
mitk::DataNode::Pointer QmitkDataStorageTreeModel::GetNode | ( | const QModelIndex & | index | ) | const |
Get node at a specific model index. This function is used to get a node from a QModelIndex
Definition at line 65 of file QmitkDataStorageTreeModel.cpp.
References QmitkDataStorageTreeModel::TreeItem::GetDataNode(), and TreeItemFromIndex().
Referenced by QmitkDataManagerView::ColorActionChanged(), QmitkDataManagerView::ColorChanged(), QmitkDataManagerView::ColormapActionToggled(), QmitkDataManagerView::ColormapMenuAboutToShow(), QmitkDataManagerView::ComponentActionChanged(), QmitkDataStorageFilterProxyModel::filterAcceptsRow(), QmitkDataManagerView::NodeTableViewContextMenuRequested(), QmitkDataManagerView::OpacityActionChanged(), QmitkDataManagerView::OpacityChanged(), QmitkDataManagerView::RemoveSelectedNodes(), QmitkDataManagerView::SurfaceRepresentationActionToggled(), QmitkDataManagerView::SurfaceRepresentationMenuAboutToShow(), QmitkDataManagerView::TextureInterpolationChanged(), and QmitkDataManagerView::TextureInterpolationToggled().
|
virtual |
Returns a copy of the node-vector that is shown by this model
Definition at line 815 of file QmitkDataStorageTreeModel.cpp.
References m_Root, and TreeToNodeSet().
Referenced by QmitkDataManagerView::MakeAllNodesInvisible(), QmitkDataManagerView::NodeSelectionChanged(), and QmitkDataManagerView::ShowOnlySelectedNodes().
|
protected |
Returns the first element in the nodes sources list (if available) or 0
Definition at line 725 of file QmitkDataStorageTreeModel.cpp.
References mitk::DataStorage::GetSources(), and m_DataStorage.
|
inline |
Get the top placement flag
Definition at line 68 of file QmitkDataStorageTreeModel.h.
Referenced by QmitkDataManagerView::OnPreferencesChanged().
|
override |
Definition at line 530 of file QmitkDataStorageTreeModel.cpp.
References QmitkDataStorageTreeModel::TreeItem::GetDataNode(), and m_Root.
|
override |
called whenever the model or the view needs to create a QModelIndex for a particular child item (or a top-level item if parent is an invalid QModelIndex)
Definition at line 75 of file QmitkDataStorageTreeModel.cpp.
References QmitkDataStorageTreeModel::TreeItem::GetChild(), and m_Root.
|
protected |
Gives a ModelIndex for the Tree Item
Definition at line 807 of file QmitkDataStorageTreeModel.cpp.
References QmitkDataStorageTreeModel::TreeItem::GetIndex(), and m_Root.
Referenced by dropMimeData(), and GetIndex().
|
override |
Definition at line 378 of file QmitkDataStorageTreeModel.cpp.
References mimeDataFromModelIndexList().
|
static |
Definition at line 383 of file QmitkDataStorageTreeModel.cpp.
References QmitkMimeTypes::DataNodePtrs, QmitkMimeTypes::DataStorageTreeItemPtrs, and QmitkDataStorageTreeModel::TreeItem::GetDataNode().
Referenced by mimeData().
|
override |
Definition at line 370 of file QmitkDataStorageTreeModel.cpp.
|
override |
Definition at line 121 of file QmitkDataStorageTreeModel.cpp.
References QmitkDataStorageTreeModel::TreeItem::GetIndex(), QmitkDataStorageTreeModel::TreeItem::GetParent(), m_Root, and TreeItemFromIndex().
|
virtual |
Removes a node from this model. Also removes any event listener from the node.
Definition at line 701 of file QmitkDataStorageTreeModel.cpp.
References m_BlockDataStorageEvents.
Referenced by SetDataStorage().
|
override |
Definition at line 91 of file QmitkDataStorageTreeModel.cpp.
References QmitkDataStorageTreeModel::TreeItem::GetChildCount(), and TreeItemFromIndex().
Referenced by QmitkDataManagerView::NodeTreeViewRowsInserted(), and QmitkDataManagerView::NodeTreeViewRowsRemoved().
void QmitkDataStorageTreeModel::SetAllowHierarchyChange | ( | bool | allowHierarchyChange | ) |
Set whether to allow hierarchy changes by dragging and dropping.
Definition at line 1007 of file QmitkDataStorageTreeModel.cpp.
References m_AllowHierarchyChange.
Referenced by QmitkDataManagerView::CreateQtPartControl(), and QmitkDataManagerView::OnPreferencesChanged().
|
override |
Definition at line 737 of file QmitkDataStorageTreeModel.cpp.
References mitk::DataNode::GetData(), QmitkDataStorageTreeModel::TreeItem::GetDataNode(), mitk::RenderingManager::GetInstance(), mitk::RenderingManager::RequestUpdateAll(), mitk::DataNode::SetStringProperty(), mitk::DataNode::SetVisibility(), and TreeItemFromIndex().
void QmitkDataStorageTreeModel::SetDataStorage | ( | mitk::DataStorage * | _DataStorage | ) |
Sets the DataStorage. The whole model will be resetted.
Definition at line 538 of file QmitkDataStorageTreeModel.cpp.
References mitk::MessageBase< AbstractDelegate >::AddListener(), AddNode(), mitk::DataStorage::AddNodeEvent, mitk::DataStorage::ChangedNodeEvent, QmitkDataStorageTreeModel::TreeItem::Delete(), mitk::DataStorage::GetSubset(), mitk::WeakPointer< TObjectType >::IsNotNull(), m_DataStorage, m_Predicate, m_Root, mitk::DataNode::New(), mitk::WeakPointer< TObjectType >::ObjectDelete, mitk::MessageBase< AbstractDelegate >::RemoveListener(), RemoveNode(), mitk::DataStorage::RemoveNodeEvent, SetDataStorageDeleted(), SetNodeModified(), and Update().
Referenced by QmitkDataStorageTreeModel(), SetDataStorageDeleted(), and ~QmitkDataStorageTreeModel().
void QmitkDataStorageTreeModel::SetDataStorageDeleted | ( | const itk::Object * | _DataStorage | ) |
Notify that the DataStorage was deleted. The whole model will be resetted.
Definition at line 600 of file QmitkDataStorageTreeModel.cpp.
References SetDataStorage().
Referenced by SetDataStorage().
|
override |
Definition at line 768 of file QmitkDataStorageTreeModel.cpp.
|
virtual |
Sets a node to modfified. Called by the DataStorage
Definition at line 709 of file QmitkDataStorageTreeModel.cpp.
References QmitkDataStorageTreeModel::TreeItem::Find(), QmitkDataStorageTreeModel::TreeItem::GetIndex(), QmitkDataStorageTreeModel::TreeItem::GetParent(), and m_Root.
Referenced by SetDataStorage().
void QmitkDataStorageTreeModel::SetPlaceNewNodesOnTop | ( | bool | _PlaceNewNodesOnTop | ) |
Set the top placement flag
Definition at line 658 of file QmitkDataStorageTreeModel.cpp.
References m_PlaceNewNodesOnTop.
Referenced by QmitkDataManagerView::CreateQtPartControl(), and QmitkDataManagerView::OnPreferencesChanged().
|
override |
Definition at line 147 of file QmitkDataStorageTreeModel.cpp.
|
override |
Definition at line 142 of file QmitkDataStorageTreeModel.cpp.
|
protected |
Definition at line 846 of file QmitkDataStorageTreeModel.cpp.
References QmitkMimeTypes::DataStorageTreeItemPtrs.
Referenced by dropMimeData().
|
protected |
Definition at line 855 of file QmitkDataStorageTreeModel.cpp.
|
protected |
invoked after m_DataStorage or m_Predicate changed
Definition at line 135 of file QmitkDataStorageTreeModel.cpp.
References m_Root.
Referenced by data(), dropMimeData(), flags(), GetNode(), parent(), rowCount(), and setData().
|
protected |
Adds all Childs in parent to vec. Before a child is added the function is called recursively
Definition at line 824 of file QmitkDataStorageTreeModel.cpp.
References QmitkDataStorageTreeModel::TreeItem::GetChild(), QmitkDataStorageTreeModel::TreeItem::GetChildCount(), and QmitkDataStorageTreeModel::TreeItem::GetDataNode().
Referenced by GetNodeSet().
|
protected |
Adds all Childs in parent to vec. Before a child is added the function is called recursively
Definition at line 796 of file QmitkDataStorageTreeModel.cpp.
References QmitkDataStorageTreeModel::TreeItem::GetChild(), and QmitkDataStorageTreeModel::TreeItem::GetChildCount().
Referenced by AdjustLayerProperty().
|
protected |
Update Tree Model
Definition at line 990 of file QmitkDataStorageTreeModel.cpp.
References mitk::DataStorage::GetAll(), mitk::WeakPointer< TObjectType >::IsNotNull(), and m_DataStorage.
Referenced by SetDataStorage().
|
static |
Definition at line 40 of file QmitkDataStorageTreeModel.h.
|
static |
Definition at line 41 of file QmitkDataStorageTreeModel.h.
|
static |
Definition at line 42 of file QmitkDataStorageTreeModel.h.
|
protected |
This decides whether or not it is allowed to assign a different parent to a node If it is false, it is not possible to change the hierarchy of nodes by dragging and dropping. If it is true, dragging nodes on another node will replace all of their parents with that one.
Definition at line 258 of file QmitkDataStorageTreeModel.h.
Referenced by dropMimeData(), and SetAllowHierarchyChange().
|
protected |
Flag to block the data storage events if nodes are added/removed by this class.
Definition at line 251 of file QmitkDataStorageTreeModel.h.
Referenced by AddNode(), dropMimeData(), and RemoveNode().
|
protected |
Definition at line 245 of file QmitkDataStorageTreeModel.h.
Referenced by AddNode(), dropMimeData(), GetDataStorage(), GetParentNode(), SetDataStorage(), and Update().
|
protected |
Definition at line 247 of file QmitkDataStorageTreeModel.h.
Referenced by SetPlaceNewNodesOnTop().
|
protected |
Definition at line 246 of file QmitkDataStorageTreeModel.h.
Referenced by SetDataStorage().
|
protected |
Definition at line 248 of file QmitkDataStorageTreeModel.h.
Referenced by AddNode(), AdjustLayerProperty(), dropMimeData(), GetIndex(), GetNodeSet(), headerData(), index(), IndexFromTreeItem(), parent(), SetDataStorage(), SetNodeModified(), TreeItemFromIndex(), and ~QmitkDataStorageTreeModel().