summaryrefslogtreecommitdiffstats
path: root/src/gui/util/qgridlayoutengine.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-10-15 21:05:08 +0200
committerOrgad Shaneh <orgad.shaneh@audiocodes.com>2017-10-16 22:21:52 +0300
commit01afc8c810201b93a12fe7030344e03566d99001 (patch)
tree27727b38370209dc158856b4bb4d32ccd2e49fbe /src/gui/util/qgridlayoutengine.cpp
parenta090076e93487f8e461d9b866b9da1c0c21cb59b (diff)
parent49da5ce10034161017b261e000d4e9063d962401 (diff)
Merge remote-tracking branch 'origin/5.9' into 5.10
Diffstat (limited to 'src/gui/util/qgridlayoutengine.cpp')
-rw-r--r--src/gui/util/qgridlayoutengine.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gui/util/qgridlayoutengine.cpp b/src/gui/util/qgridlayoutengine.cpp
index 8ff2a3eeec..33adac40b2 100644
--- a/src/gui/util/qgridlayoutengine.cpp
+++ b/src/gui/util/qgridlayoutengine.cpp
@@ -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);