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

Method createItem

kdevplatform/language/codegen/templatesmodel.cpp:155–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

153}
154
155QStandardItem* TemplatesModelPrivate::createItem(const QString& name, const QString& category, QStandardItem* parent)
156{
157 const QStringList path = category.split(QLatin1Char('/'));
158
159 QStringList currentPath;
160 currentPath.reserve(path.size());
161 for (const QString& entry : path) {
162 currentPath << entry;
163 if (!templateItems.contains(currentPath.join(QLatin1Char('/')))) {
164 auto* item = new QStandardItem(entry);
165 item->setEditable(false);
166 parent->appendRow(item);
167 templateItems[currentPath.join(QLatin1Char('/'))] = item;
168 parent = item;
169 } else {
170 parent = templateItems[currentPath.join(QLatin1Char('/'))];
171 }
172 }
173
174 auto* templateItem = new QStandardItem(name);
175 templateItem->setEditable(false);
176 parent->appendRow(templateItem);
177 return templateItem;
178}
179
180void TemplatesModelPrivate::extractTemplateDescriptions()
181{

Callers 1

refreshMethod · 0.45

Calls 7

joinMethod · 0.80
appendRowMethod · 0.80
splitMethod · 0.45
reserveMethod · 0.45
sizeMethod · 0.45
containsMethod · 0.45
setEditableMethod · 0.45

Tested by

no test coverage detected