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

Method moveCurrentAction

app/src/DataModel/ProjectEditor.cpp:6626–6642  ·  view source on GitHub ↗

* @brief Moves the currently selected action up or down in the actions list. */

Source from the content-addressed store, hash-verified

6624 * @brief Moves the currently selected action up or down in the actions list.
6625 */
6626bool DataModel::ProjectEditor::moveCurrentAction(int direction)
6627{
6628 if (m_currentView != ActionView)
6629 return false;
6630
6631 const int aid = m_selectedAction.actionId;
6632 if (aid < 0)
6633 return false;
6634
6635 const int n = static_cast<int>(DataModel::ProjectModel::instance().actions().size());
6636 const int target = aid + (direction < 0 ? -1 : 1);
6637 if (target < 0 || target >= n)
6638 return false;
6639
6640 DataModel::ProjectModel::instance().moveAction(aid, target);
6641 return true;
6642}
6643
6644/**
6645 * @brief Moves the currently selected output widget within its group.

Callers

nothing calls this directly

Calls 3

actionsMethod · 0.80
moveActionMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected