MCPcopy Create free account
hub / github.com/XRay3D/GERBER_X3 / addFile

Method addFile

static_libs/filetree/ft_model.cpp:42–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40}
41
42void Model::addFile(FileInterface* file)
43{
44 if (!file)
45 return;
46
47 const int type = int(file->type());
48
49 if (mapNode.find(type) == mapNode.end()) {
50 QModelIndex index = createIndex(0, 0, rootItem);
51 int rowCount = rootItem->childCount();
52 beginInsertRows(index, rowCount, rowCount);
53 mapNode.emplace(type, Pair { nullptr, type });
54 rootItem->addChild(mapNode[type].node = new FolderNode(App::filePlugin(type)->folderName(), new int(mapNode[type].type)));
55 endInsertRows();
56 }
57
58 Node* item(mapNode[type].node);
59 QModelIndex index = createIndex(0, 0, item);
60 int rowCount = item->childCount();
61 beginInsertRows(index, rowCount, rowCount);
62 mapNode[type].node->addChild(file->node());
63 endInsertRows();
64
65 App::filePlugin(type)->updateFileModel(file);
66 emit select(createIndex(rowCount, 0, file->node()));
67}
68
69void Model::addShape(ShapeInterface* shape)
70{

Callers

nothing calls this directly

Calls 7

endMethod · 0.80
typeMethod · 0.45
childCountMethod · 0.45
addChildMethod · 0.45
folderNameMethod · 0.45
nodeMethod · 0.45
updateFileModelMethod · 0.45

Tested by

no test coverage detected