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

Method triggerLayoutUpdate

app/src/UI/WindowManager.cpp:1399–1437  ·  view source on GitHub ↗

* @brief Reacts to changes in the desktop or available layout area. */

Source from the content-addressed store, hash-verified

1397 * @brief Reacts to changes in the desktop or available layout area.
1398 */
1399void UI::WindowManager::triggerLayoutUpdate()
1400{
1401 const int canvasW = static_cast<int>(width());
1402 const int canvasH = static_cast<int>(height());
1403 const bool sizeValid = canvasW > 0 && canvasH > 0;
1404 const bool sizeChanged =
1405 sizeValid && (canvasW != m_lastCanvasWidth || canvasH != m_lastCanvasHeight);
1406
1407 if (autoLayoutEnabled())
1408 autoLayout();
1409
1410 else {
1411 bool hasUninitializedWindows = false;
1412 for (auto* win : std::as_const(m_windows)) {
1413 if (win && !win->isVisible() && (win->state() == "normal" || win->state() == "maximized")) {
1414 hasUninitializedWindows = true;
1415 break;
1416 }
1417 }
1418
1419 if (sizeChanged)
1420 applyManualAnchors(canvasW, canvasH);
1421
1422 m_suppressGeometrySignal = sizeChanged;
1423 const bool shouldCascade = hasUninitializedWindows && !m_layoutRestored;
1424 if (shouldCascade)
1425 cascadeLayout();
1426
1427 if (!shouldCascade)
1428 constrainWindows();
1429
1430 m_suppressGeometrySignal = false;
1431 }
1432
1433 if (sizeValid) {
1434 m_lastCanvasWidth = canvasW;
1435 m_lastCanvasHeight = canvasH;
1436 }
1437}
1438
1439/**
1440 * @brief Retrieves the ID associated with a registered window item.

Callers 1

setWindowStateMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected