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

Method setActiveGroupIndex

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

* @brief Switch active group by index. */

Source from the content-addressed store, hash-verified

293 * @brief Switch active group by index.
294 */
295API::CommandResponse API::Handlers::WindowHandler::setActiveGroupIndex(const QString& id,
296 const QJsonObject& params)
297{
298 if (!params.contains(QStringLiteral("index"))) {
299 return CommandResponse::makeError(
300 id, ErrorCode::MissingParam, QStringLiteral("Missing required parameter: index"));
301 }
302
303 auto* taskbar = UI::UISessionRegistry::instance().primaryTaskbar();
304 if (!taskbar)
305 return noSession(id);
306
307 const int index = params.value(QStringLiteral("index")).toInt();
308 QMetaObject::invokeMethod(taskbar, [taskbar, index]() { taskbar->setActiveGroupIndex(index); });
309
310 QJsonObject result;
311 result[QStringLiteral("index")] = index;
312 return CommandResponse::makeSuccess(id, result);
313}
314
315//--------------------------------------------------------------------------------------------------
316// Window states

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected