/*! \reimp */ void QBoxLayout::setGeometry(const QRect &r) { Q_D(QBoxLayout); if (d->dirty || r != geometry()) { QRect oldRect = geometry(); QLayout::setGeometry(r); if (d->dirty) d->setupGeom(); QRect cr = alignment() ? alignmentRect(r) : r; int left, top, right, bottom; d->effectiveMargins(&left, &top, &right, &bottom); QRect s(cr.x() + left, cr.y() + top, cr.width() - (left + right), cr.height() - (top + bottom)); QVector<QLayoutStruct> a = d->geomArray; int pos = horz(d->dir) ? s.x() : s.y(); int space = horz(d->dir) ? s.width() : s.height(); int n = a.count(); if (d->hasHfw && !horz(d->dir)) { for (int i = 0; i < n; i++) { QBoxLayoutItem *box = d->list.at(i); if (box->item->hasHeightForWidth()) { int width = qBound(box->item->minimumSize().width(), s.width(), box->item->maximumSize().width()); a[i].sizeHint = a[i].minimumSize = box->item->heightForWidth(width); } } } Direction visualDir = d->dir; QWidget *parent = parentWidget(); if (parent && parent->isRightToLeft()) { if (d->dir == LeftToRight) visualDir = RightToLeft; else if (d->dir == RightToLeft) visualDir = LeftToRight; } qGeomCalc(a, 0, n, pos, space); bool reverse = (horz(visualDir) ? ((r.right() > oldRect.right()) != (visualDir == RightToLeft)) : r.bottom() > oldRect.bottom()); for (int j = 0; j < n; j++) { int i = reverse ? n-j-1 : j; QBoxLayoutItem *box = d->list.at(i); switch (visualDir) { case LeftToRight: box->item->setGeometry(QRect(a.at(i).pos, s.y(), a.at(i).size, s.height())); break; case RightToLeft: box->item->setGeometry(QRect(s.left() + s.right() - a.at(i).pos - a.at(i).size + 1, s.y(), a.at(i).size, s.height())); break; case TopToBottom: box->item->setGeometry(QRect(s.x(), a.at(i).pos, s.width(), a.at(i).size)); break; case BottomToTop: box->item->setGeometry(QRect(s.x(), s.top() + s.bottom() - a.at(i).pos - a.at(i).size + 1, s.width(), a.at(i).size)); } } } }
QRect DhQLayout::DvhalignmentRect(const QRect& x1) const { return alignmentRect(x1); }