313 const int n = widgets.
size();
315 const int nrows =
qMax((n % ncols) ? (n / ncols + 1) : (n / ncols), 1);
316 const int nspecial = (n % ncols) ? (ncols - n % ncols) : 0;
317 const int dx = domain.
width() / ncols;
318 const int dy = domain.
height() / nrows;
321 for (
int row = 0; row < nrows; ++row) {
322 const int y1 = int(row * (dy + 1));
323 for (
int col = 0; col < ncols; ++col) {
324 if (row == 1 && col < nspecial)
326 const int x1 = int(col * (dx + 1));
327 int x2 = int(x1 + dx);
328 int y2 = int(y1 + dy);
329 if (row == 0 && col < nspecial) {
336 if (col == ncols - 1 && x2 != domain.
right())
338 if (row == nrows - 1 && y2 != domain.
bottom())
QPointer< QWidget > widget
int width() const
Returns the width of the rectangle.
int height() const
Returns the height of the rectangle.
int bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
static bool sanityCheck(const QMdiSubWindow *const child, const char *where)
const T & at(int i) const
Returns the item at index position i in the list.
static QRect visualRect(Qt::LayoutDirection direction, const QRect &boundingRect, const QRect &logicalRect)
Returns the given logicalRectangle converted to screen coordinates based on the specified direction...
int right() const
Returns the x-coordinate of the rectangle's right edge.
The QPoint class defines a point in the plane using integer precision.
int size() const
Returns the number of items in the list.
The QRect class defines a rectangle in the plane using integer precision.