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

Method removeWidgetFromWorkspace

app/src/DataModel/ProjectModel.cpp:5860–5881  ·  view source on GitHub ↗

* @brief Removes a widget reference from the specified workspace by index. */

Source from the content-addressed store, hash-verified

5858 * @brief Removes a widget reference from the specified workspace by index.
5859 */
5860void 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).

Callers 3

widgetRemoveMethod · 0.80
setWorkspaceWidgetsMethod · 0.80

Calls 3

operationModeMethod · 0.80
beginMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected