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

Method setActiveGroup

app/src/API/Handlers/WindowHandler.cpp:271–290  ·  view source on GitHub ↗

* @brief Switch active group by group ID. */

Source from the content-addressed store, hash-verified

269 * @brief Switch active group by group ID.
270 */
271API::CommandResponse API::Handlers::WindowHandler::setActiveGroup(const QString& id,
272 const QJsonObject& params)
273{
274 if (!params.contains(QStringLiteral("groupId"))) {
275 return CommandResponse::makeError(
276 id, ErrorCode::MissingParam, QStringLiteral("Missing required parameter: groupId"));
277 }
278
279 auto* taskbar = UI::UISessionRegistry::instance().primaryTaskbar();
280 if (!taskbar)
281 return noSession(id);
282
283 const int group_id = params.value(QStringLiteral("groupId")).toInt();
284 QMetaObject::invokeMethod(taskbar,
285 [taskbar, group_id]() { taskbar->setActiveGroupId(group_id); });
286
287 QJsonObject result;
288 result[QStringLiteral("groupId")] = group_id;
289 return CommandResponse::makeSuccess(id, result);
290}
291
292/**
293 * @brief Switch active group by index.

Callers

nothing calls this directly

Calls 5

noSessionFunction · 0.85
primaryTaskbarMethod · 0.80
containsMethod · 0.45
valueMethod · 0.45
setActiveGroupIdMethod · 0.45

Tested by

no test coverage detected