QFormLayout: honor Qt::AlignHCenter for labelAlignment
The QFormLayout did not handle Qt::AlignCenter, only Qt::AlignLeft/Right for the labelAlignment property. Therefore also add the code for Qt::AlignHCenter to be consistent Fixes: QTBUG-2780 Change-Id: I0d6dd61ba583e3ee37a003fae000d992505c08d1 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>bb10
parent
7984327c40
commit
0b736d91b7
|
|
@ -2209,8 +2209,11 @@ void QFormLayoutPrivate::arrangeWidgets(const QVector<QLayoutStruct>& layouts, Q
|
|||
|
||||
QSize sz(qMin(label->layoutWidth, label->sizeHint.width()), height);
|
||||
int x = leftOffset + rect.x() + label->layoutPos;
|
||||
if (fixedAlignment(q->labelAlignment(), layoutDirection) & Qt::AlignRight)
|
||||
const auto fAlign = fixedAlignment(q->labelAlignment(), layoutDirection);
|
||||
if (fAlign & Qt::AlignRight)
|
||||
x += label->layoutWidth - sz.width();
|
||||
else if (fAlign & Qt::AlignHCenter)
|
||||
x += label->layoutWidth / 2 - sz.width() / 2;
|
||||
QPoint p(x, layouts.at(label->vLayoutIndex).pos);
|
||||
// ### expansion & sizepolicy stuff
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue