* @brief Returns the anchored geometry for a preferred size within a canvas. */
| 211 | * @brief Returns the anchored geometry for a preferred size within a canvas. |
| 212 | */ |
| 213 | static 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. |
no test coverage detected