* @brief Appends a copy of the currently selected action to the project. */
| 3562 | * @brief Appends a copy of the currently selected action to the project. |
| 3563 | */ |
| 3564 | void DataModel::ProjectModel::duplicateCurrentAction() |
| 3565 | { |
| 3566 | DataModel::Action action; |
| 3567 | action.actionId = m_actions.size(); |
| 3568 | action.icon = m_selectedAction.icon; |
| 3569 | action.txData = m_selectedAction.txData; |
| 3570 | action.timerMode = m_selectedAction.timerMode; |
| 3571 | action.repeatCount = m_selectedAction.repeatCount; |
| 3572 | action.eolSequence = m_selectedAction.eolSequence; |
| 3573 | action.timerIntervalMs = m_selectedAction.timerIntervalMs; |
| 3574 | action.autoExecuteOnConnect = m_selectedAction.autoExecuteOnConnect; |
| 3575 | |
| 3576 | QStringList existingTitles; |
| 3577 | existingTitles.reserve(static_cast<int>(m_actions.size())); |
| 3578 | for (const auto& a : m_actions) |
| 3579 | existingTitles.append(a.title); |
| 3580 | |
| 3581 | action.title = nextDuplicateTitle(m_selectedAction.title, existingTitles); |
| 3582 | |
| 3583 | m_actions.push_back(action); |
| 3584 | m_selectedAction = action; |
| 3585 | |
| 3586 | Q_EMIT actionsChanged(); |
| 3587 | Q_EMIT actionAdded(static_cast<int>(m_actions.size()) - 1); |
| 3588 | setModified(true); |
| 3589 | } |
| 3590 | |
| 3591 | //-------------------------------------------------------------------------------------------------- |
| 3592 | // Group / dataset / workspace / action reorder |
nothing calls this directly
no test coverage detected