MCPcopy Create free account
hub / github.com/KDE/kdevelop / appendChild

Method appendChild

kdevplatform/debugger/util/treeitem.cpp:36–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36void TreeItem::appendChild(TreeItem *item, bool initial)
37{
38 QModelIndex index = model_->indexForItem(this, 0);
39
40 // Note that we need emit beginRemoveRows, even if we're replacing
41 // ellipsis item with the real one. The number of rows does not change
42 // with the result, but the last item is different. The address of the
43 // item is stored inside QModelIndex, so just replacing the item, and
44 // deleting the old one, will lead to crash.
45 if (more_)
46 {
47 if (!initial)
48 model_->beginRemoveRows(index, childItems.size(), childItems.size());
49 more_ = false;
50 delete ellipsis_;
51 ellipsis_ = nullptr;
52 if (!initial)
53 model_->endRemoveRows();
54 }
55
56 if (!initial)
57 model_->beginInsertRows(index, childItems.size(), childItems.size());
58 childItems.append(item);
59 if (!initial)
60 model_->endInsertRows();
61}
62
63void TreeItem::insertChild(int position, TreeItem *child, bool initial)
64{

Callers

nothing calls this directly

Calls 3

indexForItemMethod · 0.80
sizeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected