MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / appendItem

Method appendItem

src/plugins/debugger/interface/localtreemodel.cpp:162–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160}
161
162void LocalTreeModel::appendItem(LocalTreeItem *parent, const IVariables &vars)
163{
164 QWriteLocker locker(&mutex);
165 if (!items.contains(parent) && parent != rootItem)
166 return;
167 locker.unlock();
168
169 if (parent) {
170 QList<LocalTreeItem *> newItems;
171
172 // when fetchChild do not highlight variables.
173 // append item to a parent which has child, highLight new item
174 bool fetchChild = parent->childCount() == 0;
175
176 for (auto var : vars) {
177 auto item = parent->updateVariable(var.var);
178 //item = nullptr : parent has no child equal this var
179 if (!item) {
180 beginInsertColumns(parent->index(), parent->childCount(), 1);
181 item = new LocalTreeItem(this, parent);
182 item->setUpdated(!fetchChild);
183 item->setVariable(var.var);
184 parent->appendChild(item);
185
186 locker.relock();
187 items.append(item);
188 locker.unlock();
189
190 endInsertRows();
191 }
192
193 newItems.append(item);
194 }
195 parent->removeRedundantItems(newItems);
196 }
197}
198
199void LocalTreeModel::setDatas(IVariables &datas)
200{

Callers 1

initializeViewMethod · 0.45

Calls 10

childCountMethod · 0.80
updateVariableMethod · 0.80
setUpdatedMethod · 0.80
removeRedundantItemsMethod · 0.80
containsMethod · 0.45
unlockMethod · 0.45
indexMethod · 0.45
setVariableMethod · 0.45
appendChildMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected