Prevent changing the width for layout item's rect
For gridlayout items the x position is rounded, but the QRectF changes the width to keep the right edge. The width is yet calculated exactly for the text so we need to preserve it. Task-number: QTBUG-61244 Change-Id: I823ba742c9ab299740232b5d9b4ad5713e1782c4 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>bb10
parent
248beda08f
commit
0366f68b6d
|
|
@ -1051,10 +1051,12 @@ void QGridLayoutEngine::setGeometries(const QRectF &contentsGeometry, const QAbs
|
|||
if (m_snapToPixelGrid) {
|
||||
// x and y should already be rounded, but the call to geometryWithin() above might
|
||||
// result in a geom with x,y at half-pixels (due to centering within the cell)
|
||||
geom.setX(qround(geom.x()));
|
||||
// QRectF may change the width as it wants to maintain the right edge. In this
|
||||
// case the width need to be preserved.
|
||||
geom.moveLeft(qround(geom.x()));
|
||||
// Do not snap baseline aligned items, since that might cause the baselines to not be aligned.
|
||||
if (align != Qt::AlignBaseline)
|
||||
geom.setY(qround(geom.y()));
|
||||
geom.moveTop(qround(geom.y()));
|
||||
}
|
||||
visualRect(&geom, visualDirection(), contentsGeometry);
|
||||
item->setGeometry(geom);
|
||||
|
|
|
|||
Loading…
Reference in New Issue