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

Function refsToJson

app/src/API/Handlers/WorkspacesHandler.cpp:124–140  ·  view source on GitHub ↗

* @brief Serialises a workspace's widget refs as a QJsonArray of objects. */

Source from the content-addressed store, hash-verified

122 * @brief Serialises a workspace's widget refs as a QJsonArray of objects.
123 */
124[[nodiscard]] static QJsonArray refsToJson(int workspaceId,
125 const std::vector<DataModel::WidgetRef>& refs)
126{
127 QJsonArray arr;
128 for (const auto& r : refs) {
129 QJsonObject entry;
130 entry[QStringLiteral("widgetType")] = r.widgetType;
131 entry[QStringLiteral("widgetTypeSlug")] = API::EnumLabels::dashboardWidgetSlug(r.widgetType);
132 entry[QStringLiteral("groupId")] = r.groupUniqueId;
133 entry[QStringLiteral("relativeIndex")] = r.relativeIndex;
134 entry[QStringLiteral("widgetId")] =
135 widgetIdFor(workspaceId, r.widgetType, r.groupUniqueId, r.relativeIndex);
136 arr.append(entry);
137 }
138
139 return arr;
140}
141
142/**
143 * @brief Returns a hint on how to unlock @a wtype on @a group, or empty when none applies.

Callers 1

getMethod · 0.85

Calls 2

widgetIdForFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected