Don't ignore horizontal alignment for items with baseline alignments
Horizontal alignment were ignored when an item had baseline alignment specified. Change-Id: I2df526dc830952cdc26e1973d4787e9457c94edd Reviewed-by: J-P Nurmi <jpnurmi@digia.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
This commit is contained in:
parent
3cdd0358b3
commit
f25aca5c65
@ -618,11 +618,8 @@ QGridLayoutBox QGridLayoutItem::box(Qt::Orientation orientation, qreal constrain
|
|||||||
QRectF QGridLayoutItem::geometryWithin(qreal x, qreal y, qreal width, qreal height,
|
QRectF QGridLayoutItem::geometryWithin(qreal x, qreal y, qreal width, qreal height,
|
||||||
qreal rowDescent, Qt::Alignment align) const
|
qreal rowDescent, Qt::Alignment align) const
|
||||||
{
|
{
|
||||||
QGridLayoutBox vBox = box(Qt::Vertical);
|
const qreal cellWidth = width;
|
||||||
if (!(align & Qt::AlignBaseline) || vBox.q_minimumDescent < 0.0 || rowDescent < 0.0) {
|
const qreal cellHeight = height;
|
||||||
qreal cellWidth = width;
|
|
||||||
qreal cellHeight = height;
|
|
||||||
|
|
||||||
|
|
||||||
QSizeF size = effectiveMaxSize(QSizeF(-1,-1));
|
QSizeF size = effectiveMaxSize(QSizeF(-1,-1));
|
||||||
if (hasDynamicConstraint()) {
|
if (hasDynamicConstraint()) {
|
||||||
@ -647,6 +644,7 @@ QRectF QGridLayoutItem::geometryWithin(qreal x, qreal y, qreal width, qreal heig
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (align & Qt::AlignVertical_Mask) {
|
switch (align & Qt::AlignVertical_Mask) {
|
||||||
case Qt::AlignVCenter:
|
case Qt::AlignVCenter:
|
||||||
y += (cellHeight - height)/2;
|
y += (cellHeight - height)/2;
|
||||||
@ -654,16 +652,18 @@ QRectF QGridLayoutItem::geometryWithin(qreal x, qreal y, qreal width, qreal heig
|
|||||||
case Qt::AlignBottom:
|
case Qt::AlignBottom:
|
||||||
y += cellHeight - height;
|
y += cellHeight - height;
|
||||||
break;
|
break;
|
||||||
|
case Qt::AlignBaseline: {
|
||||||
|
width = qMin(effectiveMaxSize(QSizeF(-1,-1)).width(), width);
|
||||||
|
QGridLayoutBox vBox = box(Qt::Vertical);
|
||||||
|
const qreal descent = vBox.q_minimumDescent;
|
||||||
|
const qreal ascent = vBox.q_minimumSize - descent;
|
||||||
|
y += (cellHeight - rowDescent - ascent);
|
||||||
|
height = ascent + descent;
|
||||||
|
break; }
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return QRectF(x, y, width, height);
|
return QRectF(x, y, width, height);
|
||||||
} else {
|
|
||||||
width = qMin(effectiveMaxSize(QSizeF(-1,-1)).width(), width);
|
|
||||||
qreal descent = vBox.q_minimumDescent;
|
|
||||||
qreal ascent = vBox.q_minimumSize - descent;
|
|
||||||
return QRectF(x, y + height - rowDescent - ascent, width, ascent + descent);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGridLayoutItem::transpose()
|
void QGridLayoutItem::transpose()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user