44 const QMargins margins = contentsMargins();
45 const QSize marginsSize = QSize(margins.left() + margins.right(), margins.top() + margins.bottom());
48 for (
const QLayoutItem *item : std::as_const(
m_items))
49 size = size.expandedTo(item->minimumSize());
51 if (!geometry().isEmpty()) {
52 QSize optimal = QSize(geometry().width(),
heightForWidth(geometry().width()));
53 int minimumWidth = size.width();
54 int minimumHeight = qMax(size.height(), optimal.height());
55 QSize minimum = QSize(minimumWidth, minimumHeight);
100 int left, top, right, bottom;
101 getContentsMargins(&left, &top, &right, &bottom);
102 QRect effectiveRect =
rect.adjusted(+left, +top, -right, -bottom);
103 int x = effectiveRect.x();
104 int y = effectiveRect.y();
107 for (QLayoutItem *item : std::as_const(
m_items)) {
108 int nextX = x + item->sizeHint().width() + spacing();
109 if (nextX - spacing() > effectiveRect.right() && lineHeight > 0) {
110 x = effectiveRect.x();
111 y = y + lineHeight + spacing();
112 nextX = x + item->sizeHint().width() + spacing();
117 item->setGeometry(QRect(QPoint(x, y), item->sizeHint()));
121 lineHeight = qMax(lineHeight, item->sizeHint().height());
123 return y + lineHeight -
rect.y() + bottom;