* @brief Returns manual anchor margins for a geometry within a canvas. */
| 196 | * @brief Returns manual anchor margins for a geometry within a canvas. |
| 197 | */ |
| 198 | static 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. |
no test coverage detected