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

Method moveTableFolderToFolder

app/src/DataModel/ProjectModel.cpp:6652–6672  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

6650 * @brief Re-parents a table folder, rejecting a cyclic move into its own subtree.
6651 */
6652void DataModel::ProjectModel::moveTableFolderToFolder(int folderId, int parentFolderId)
6653{
6654 if (parentFolderId != -1 && !folderExists(m_tableFolders, parentFolderId))
6655 return;
6656
6657 if (folderIsSelfOrDescendant(m_tableFolders, folderId, parentFolderId))
6658 return;
6659
6660 for (auto& f : m_tableFolders) {
6661 if (f.folderId != folderId)
6662 continue;
6663
6664 if (f.parentFolderId == parentFolderId)
6665 return;
6666
6667 f.parentFolderId = parentFolderId;
6668 setModified(true);
6669 Q_EMIT tablesChanged();
6670 return;
6671 }
6672}
6673
6674/**
6675 * @brief Reorders a table 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