* @brief Removes a widget reference from the specified workspace by index. */
| 5858 | * @brief Removes a widget reference from the specified workspace by index. |
| 5859 | */ |
| 5860 | void DataModel::ProjectModel::removeWidgetFromWorkspace(int workspaceId, int index) |
| 5861 | { |
| 5862 | if (AppState::instance().operationMode() != SerialStudio::ProjectFile) |
| 5863 | return; |
| 5864 | |
| 5865 | if (!m_customizeWorkspaces) |
| 5866 | setCustomizeWorkspaces(true); |
| 5867 | |
| 5868 | for (auto& ws : m_workspaces) { |
| 5869 | if (ws.workspaceId != workspaceId) |
| 5870 | continue; |
| 5871 | |
| 5872 | if (index < 0 || static_cast<size_t>(index) >= ws.widgetRefs.size()) |
| 5873 | return; |
| 5874 | |
| 5875 | ws.widgetRefs.erase(ws.widgetRefs.begin() + index); |
| 5876 | setModified(true); |
| 5877 | Q_EMIT editorWorkspacesChanged(); |
| 5878 | Q_EMIT activeWorkspacesChanged(); |
| 5879 | return; |
| 5880 | } |
| 5881 | } |
| 5882 | |
| 5883 | /** |
| 5884 | * @brief Removes a widget reference matching (widgetType, groupId, relativeIndex). |
no test coverage detected