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

Function anchoredGeometry

app/src/UI/WindowManager.cpp:213–226  ·  view source on GitHub ↗

* @brief Returns the anchored geometry for a preferred size within a canvas. */

Source from the content-addressed store, hash-verified

211 * @brief Returns the anchored geometry for a preferred size within a canvas.
212 */
213static QRect anchoredGeometry(const QRect& preferred,
214 const QMargins& margins,
215 const int canvasW,
216 const int canvasH)
217{
218 if (canvasW <= 0 || canvasH <= 0)
219 return preferred;
220
221 const bool anchorLeft = margins.left() <= margins.right();
222 const bool anchorTop = margins.top() <= margins.bottom();
223 const int x = anchorLeft ? margins.left() : canvasW - (margins.right() + preferred.width());
224 const int y = anchorTop ? margins.top() : canvasH - (margins.bottom() + preferred.height());
225 return QRect(x, y, preferred.width(), preferred.height());
226}
227
228/**
229 * @brief Returns true if any tracked window is currently in the maximized state.

Callers 3

applySavedGeometriesMethod · 0.85
applyManualAnchorsMethod · 0.85

Calls 2

widthMethod · 0.80
heightMethod · 0.80

Tested by

no test coverage detected