summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout_p.cpp37
1 files changed, 25 insertions, 12 deletions
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
index e760642..87f5aa0 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
+++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
@@ -2068,22 +2068,35 @@ void QGraphicsAnchorLayoutPrivate::setItemsGeometries(const QRectF &geom)
right = geom.right() - right;
foreach (QGraphicsLayoutItem *item, items) {
- firstH = internalVertex(item, Qt::AnchorLeft);
- secondH = internalVertex(item, Qt::AnchorRight);
- firstV = internalVertex(item, Qt::AnchorTop);
- secondV = internalVertex(item, Qt::AnchorBottom);
-
QRectF newGeom;
- newGeom.setTop(top + firstV->distance);
- newGeom.setBottom(top + secondV->distance);
+ QSizeF itemPreferredSize = item->effectiveSizeHint(Qt::PreferredSize);
+ if (m_nonFloatItems[Horizontal].contains(item)) {
+ firstH = internalVertex(item, Qt::AnchorLeft);
+ secondH = internalVertex(item, Qt::AnchorRight);
+
+ if (visualDir == Qt::LeftToRight) {
+ newGeom.setLeft(left + firstH->distance);
+ newGeom.setRight(left + secondH->distance);
+ } else {
+ newGeom.setLeft(right - secondH->distance);
+ newGeom.setRight(right - firstH->distance);
+ }
+ } else {
+ newGeom.setLeft(0);
+ newGeom.setRight(itemPreferredSize.width());
+ }
+
+ if (m_nonFloatItems[Vertical].contains(item)) {
+ firstV = internalVertex(item, Qt::AnchorTop);
+ secondV = internalVertex(item, Qt::AnchorBottom);
- if (visualDir == Qt::LeftToRight) {
- newGeom.setLeft(left + firstH->distance);
- newGeom.setRight(left + secondH->distance);
+ newGeom.setTop(top + firstV->distance);
+ newGeom.setBottom(top + secondV->distance);
} else {
- newGeom.setLeft(right - secondH->distance);
- newGeom.setRight(right - firstH->distance);
+ newGeom.setTop(0);
+ newGeom.setBottom(itemPreferredSize.height());
}
+
item->setGeometry(newGeom);
}
}