MCPcopy Create free account
hub / github.com/MITK/MITK / parent

Method parent

Modules/QtWidgets/src/QmitkDataStorageSimpleTreeModel.cpp:141–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139}
140
141QModelIndex QmitkDataStorageSimpleTreeModel::parent(const QModelIndex &child) const
142{
143 if (!child.isValid() || !m_Root || child.model() != this)
144 return QModelIndex();
145
146 TreeItem *childItem = this->TreeItemFromIndex(child);
147
148 if (!childItem)
149 return QModelIndex();
150
151 TreeItem *parentItem = childItem->GetParent();
152
153 if (parentItem == m_Root)
154 return QModelIndex();
155
156 return this->createIndex(parentItem->GetIndex(), 0, parentItem);
157}
158
159QmitkDataStorageSimpleTreeModel::TreeItem *QmitkDataStorageSimpleTreeModel::TreeItemFromIndex(
160 const QModelIndex &index) const

Callers

nothing calls this directly

Calls 4

TreeItemFromIndexMethod · 0.95
QModelIndexClass · 0.50
GetParentMethod · 0.45
GetIndexMethod · 0.45

Tested by

no test coverage detected