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

Method setLayout

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

* @brief Apply a layout to the WindowManager. */

Source from the content-addressed store, hash-verified

480 * @brief Apply a layout to the WindowManager.
481 */
482API::CommandResponse API::Handlers::WindowHandler::setLayout(const QString& id,
483 const QJsonObject& params)
484{
485 if (!params.contains(QStringLiteral("layout"))) {
486 return CommandResponse::makeError(
487 id, ErrorCode::MissingParam, QStringLiteral("Missing required parameter: layout"));
488 }
489
490 auto* wm = UI::UISessionRegistry::instance().primaryWindowManager();
491 if (!wm)
492 return noSession(id);
493
494 const QJsonObject layout = params.value(QStringLiteral("layout")).toObject();
495 QMetaObject::invokeMethod(wm, [wm, layout]() { (void)wm->restoreLayout(layout); });
496
497 return CommandResponse::makeSuccess(id);
498}
499
500//--------------------------------------------------------------------------------------------------
501// Widget settings

Callers 1

createWidgetsMethod · 0.80

Calls 5

noSessionFunction · 0.85
primaryWindowManagerMethod · 0.80
restoreLayoutMethod · 0.80
containsMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected