| 153 | } |
| 154 | |
| 155 | QStandardItem* 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 | |
| 180 | void TemplatesModelPrivate::extractTemplateDescriptions() |
| 181 | { |