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

Method setAutoLayout

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

* @brief Enable or disable auto layout. */

Source from the content-addressed store, hash-verified

404 * @brief Enable or disable auto layout.
405 */
406API::CommandResponse API::Handlers::WindowHandler::setAutoLayout(const QString& id,
407 const QJsonObject& params)
408{
409 if (!params.contains(QStringLiteral("enabled"))) {
410 return CommandResponse::makeError(
411 id, ErrorCode::MissingParam, QStringLiteral("Missing required parameter: enabled"));
412 }
413
414 auto* wm = UI::UISessionRegistry::instance().primaryWindowManager();
415 if (!wm)
416 return noSession(id);
417
418 const bool enabled = params.value(QStringLiteral("enabled")).toBool();
419 QMetaObject::invokeMethod(wm, [wm, enabled]() { wm->setAutoLayoutEnabled(enabled); });
420
421 QJsonObject result;
422 result[QStringLiteral("enabled")] = enabled;
423 return CommandResponse::makeSuccess(id, result);
424}
425
426/**
427 * @brief Save the current layout to the project (via Taskbar::saveLayout).

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected