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

Function manualMarginsForGeometry

app/src/UI/WindowManager.cpp:198–208  ·  view source on GitHub ↗

* @brief Returns manual anchor margins for a geometry within a canvas. */

Source from the content-addressed store, hash-verified

196 * @brief Returns manual anchor margins for a geometry within a canvas.
197 */
198static QMargins manualMarginsForGeometry(const QRect& geom, const int canvasW, const int canvasH)
199{
200 if (canvasW <= 0 || canvasH <= 0)
201 return QMargins();
202
203 const int left = qMax(0, geom.x());
204 const int top = qMax(0, geom.y());
205 const int right = qMax(0, canvasW - (geom.x() + geom.width()));
206 const int bottom = qMax(0, canvasH - (geom.y() + geom.height()));
207 return QMargins(left, top, right, bottom);
208}
209
210/**
211 * @brief Returns the anchored geometry for a preferred size within a canvas.

Callers 3

applySavedGeometriesMethod · 0.85
storeManualGeometryMethod · 0.85

Calls 3

xMethod · 0.80
widthMethod · 0.80
heightMethod · 0.80

Tested by

no test coverage detected