本文整理汇总了C++中TreeItem::AddChild方法的典型用法代码示例。如果您正苦于以下问题:C++ TreeItem::AddChild方法的具体用法?C++ TreeItem::AddChild怎么用?C++ TreeItem::AddChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TreeItem
的用法示例。
在下文中一共展示了TreeItem::AddChild方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RemoveNodeInternal
void QmitkDataStorageTreeModel::RemoveNodeInternal( const mitk::DataNode* node )
{
if(!m_Root) return;
TreeItem* treeItem = m_Root->Find(node);
if(!treeItem)
return; // return because there is no treeitem containing this node
TreeItem* parentTreeItem = treeItem->GetParent();
QModelIndex parentIndex = this->IndexFromTreeItem(parentTreeItem);
// emit beginRemoveRows event (QModelIndex is empty because we dont have a tree model)
this->beginRemoveRows(parentIndex, treeItem->GetIndex(), treeItem->GetIndex());
// remove node
std::vector<TreeItem*> children = treeItem->GetChildren();
delete treeItem;
// emit endRemoveRows event
endRemoveRows();
// move all children of deleted node into its parent
for ( std::vector<TreeItem*>::iterator it = children.begin()
; it != children.end(); it++)
{
// emit beginInsertRows event
beginInsertRows(parentIndex, parentTreeItem->GetChildCount(), parentTreeItem->GetChildCount());
// add nodes again
parentTreeItem->AddChild(*it);
// emit endInsertRows event
endInsertRows();
}
this->AdjustLayerProperty();
}