MCPcopy Create free account
hub / github.com/OpenBoard-org/OpenBoard / addNode

Method addNode

src/document/UBDocumentController.cpp:1437–1450  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1435}
1436
1437QModelIndex UBDocumentTreeModel::addNode(UBDocumentTreeNode *pFreeNode, const QModelIndex &pParent, eAddItemMode pMode)
1438{
1439 UBDocumentTreeNode *tstParent = nodeFromIndex(pParent);
1440
1441 if (!pParent.isValid() || tstParent->nodeType() != UBDocumentTreeNode::Catalog) {
1442 return QModelIndex();
1443 }
1444 int newIndex = pMode == aDetectPosition ? positionForParent(pFreeNode, tstParent): tstParent->children().size();
1445 beginInsertRows(pParent, newIndex, newIndex);
1446 tstParent->insertChild(newIndex, pFreeNode);
1447 endInsertRows();
1448
1449 return createIndex(newIndex, 0, pFreeNode);
1450}
1451
1452int UBDocumentTreeModel::positionForParent(UBDocumentTreeNode *pFreeNode, UBDocumentTreeNode *pParentNode)
1453{

Callers 15

tex-base.jsFile · 0.80
bFunction · 0.80
tex-full.jsFile · 0.80
bFunction · 0.80
pFunction · 0.80
gFunction · 0.80
tex.jsFile · 0.80
bFunction · 0.80
yFunction · 0.80
bussproofs.jsFile · 0.80
dFunction · 0.80
gFunction · 0.80

Calls 5

nodeTypeMethod · 0.80
childrenMethod · 0.80
insertChildMethod · 0.80
isValidMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected