MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / folderDisplayPath

Function folderDisplayPath

app/src/DataModel/ProjectEditor.cpp:168–189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166 */
167template<typename Folder>
168static QString folderDisplayPath(const std::vector<Folder>& folders, int folderId)
169{
170 QString path;
171 int cur = folderId;
172 const int kMax = static_cast<int>(folders.size());
173 for (int i = 0; i <= kMax && cur != -1; ++i) {
174 const Folder* match = nullptr;
175 for (const auto& f : folders)
176 if (f.folderId == cur) {
177 match = &f;
178 break;
179 }
180
181 if (!match)
182 break;
183
184 path = path.isEmpty() ? match->title : (match->title + QLatin1Char('/') + path);
185 cur = match->parentFolderId;
186 }
187
188 return path;
189}
190
191/**
192 * @brief Builds the nested folder hierarchy (folders only) under @p parentId for a cascading

Callers 5

appendGroupTreeItemsMethod · 0.85
groupFolderPathsMethod · 0.85

Calls 2

isEmptyMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected