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

Method InsertChild

Modules/QtWidgets/src/QmitkDataStorageTreeModelInternalItem.cpp:110–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108}
109
110void QmitkDataStorageTreeModelInternalItem::InsertChild(QmitkDataStorageTreeModelInternalItem *item, int index)
111{
112 std::vector<QmitkDataStorageTreeModelInternalItem *>::iterator it = std::find(m_Children.begin(), m_Children.end(), item);
113 if (it == m_Children.end())
114 {
115 if (m_Children.size() > 0 && index >= 0 && index < (int)m_Children.size())
116 {
117 it = m_Children.begin();
118 std::advance(it, index);
119 m_Children.insert(it, item);
120 }
121 else
122 m_Children.push_back(item);
123
124 // add parent if necessary
125 if (item->GetParent() != this)
126 item->SetParent(this);
127 }
128}
129
130std::vector<QmitkDataStorageTreeModelInternalItem *> QmitkDataStorageTreeModelInternalItem::GetChildren() const
131{

Callers 5

AddChildMethod · 0.95
dropMimeDataMethod · 0.45
AddNodeInternalMethod · 0.45
AddNodeInternalMethod · 0.45
AddNodeInternalMethod · 0.45

Calls 5

beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
GetParentMethod · 0.45
SetParentMethod · 0.45

Tested by

no test coverage detected