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

Method moveGroupFolderToFolder

app/src/DataModel/ProjectModel.cpp:6427–6447  ·  view source on GitHub ↗

* @brief Re-parents a group folder, rejecting a cyclic move into its own subtree. */

Source from the content-addressed store, hash-verified

6425 * @brief Re-parents a group folder, rejecting a cyclic move into its own subtree.
6426 */
6427void DataModel::ProjectModel::moveGroupFolderToFolder(int folderId, int parentFolderId)
6428{
6429 if (parentFolderId != -1 && !folderExists(m_groupFolders, parentFolderId))
6430 return;
6431
6432 if (folderIsSelfOrDescendant(m_groupFolders, folderId, parentFolderId))
6433 return;
6434
6435 for (auto& f : m_groupFolders) {
6436 if (f.folderId != folderId)
6437 continue;
6438
6439 if (f.parentFolderId == parentFolderId)
6440 return;
6441
6442 f.parentFolderId = parentFolderId;
6443 setModified(true);
6444 Q_EMIT groupsChanged();
6445 return;
6446 }
6447}
6448
6449/**
6450 * @brief Reorders a group folder among its sibling folders in the same parent.

Callers

nothing calls this directly

Calls 2

folderExistsFunction · 0.85
folderIsSelfOrDescendantFunction · 0.85

Tested by

no test coverage detected