| 295 | } |
| 296 | |
| 297 | void TemplateListModel::setSearchPath(const QString& searchPath) { |
| 298 | beginResetModel(); |
| 299 | mSearchPath = searchPath; |
| 300 | mFiles.clear(); |
| 301 | QStringList filter(QLatin1String("*") % PlotTemplateDialog::format); |
| 302 | QDirIterator it(searchPath, filter, QDir::AllEntries | QDir::NoSymLinks | QDir::NoDotAndDotDot, QDirIterator::Subdirectories); |
| 303 | QDir sPath(searchPath); |
| 304 | while (it.hasNext()) { |
| 305 | QFileInfo f(it.next()); |
| 306 | File file{f.absoluteFilePath(), sPath.relativeFilePath(f.absoluteFilePath()).split(PlotTemplateDialog::format).at(0)}; |
| 307 | mFiles << file; |
| 308 | } |
| 309 | endResetModel(); |
| 310 | } |
| 311 | |
| 312 | int TemplateListModel::rowCount(const QModelIndex& parent) const { |
| 313 | Q_UNUSED(parent); |
no test coverage detected