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

Method moveCurrentGroup

app/src/DataModel/ProjectEditor.cpp:6573–6592  ·  view source on GitHub ↗

* @brief Moves the currently selected group by one step (direction = -1 up, +1 down). */

Source from the content-addressed store, hash-verified

6571 * @brief Moves the currently selected group by one step (direction = -1 up, +1 down).
6572 */
6573bool DataModel::ProjectEditor::moveCurrentGroup(int direction)
6574{
6575 if (m_currentView != GroupView)
6576 return false;
6577
6578 const int gid = m_selectedGroup.groupId;
6579 if (gid < 0)
6580 return false;
6581
6582 const int n = DataModel::ProjectModel::instance().groupCount();
6583 const int target = gid + (direction < 0 ? -1 : 1);
6584 if (target < 0 || target >= n)
6585 return false;
6586
6587 m_pendingSelectionKind = PendingSelectionKind::Group;
6588 m_pendingSelectionGroupId = target;
6589 m_pendingSelectionItemId = -1;
6590 DataModel::ProjectModel::instance().moveGroup(gid, target);
6591 return true;
6592}
6593
6594/**
6595 * @brief Moves the currently selected dataset within its group.

Callers

nothing calls this directly

Calls 2

moveGroupMethod · 0.80
groupCountMethod · 0.45

Tested by

no test coverage detected