summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan-Arve Sæther <jan-arve.saether@nokia.com>2010-08-04 08:37:58 (GMT)
committerJan-Arve Sæther <jan-arve.saether@nokia.com>2010-08-10 09:02:13 (GMT)
commit30b82b9440fcfc4a703d1a2b1150efd6b4147093 (patch)
tree4fcb7e695631c9b786b7a7fb26bfd4930aac2a32
parent910b8fe6222011b8f94259f165bcf4d4002172c0 (diff)
downloadQt-30b82b9440fcfc4a703d1a2b1150efd6b4147093.zip
Qt-30b82b9440fcfc4a703d1a2b1150efd6b4147093.tar.gz
Qt-30b82b9440fcfc4a703d1a2b1150efd6b4147093.tar.bz2
Fixed a bug in implementation of sizeHint() when there was a constraint
The constraint was not adjusted with the margins before passing it on to the engine (which is unaware of the margins). Task-number: Found during QT-3570 Reviewed-by: Paul
-rw-r--r--src/gui/graphicsview/qgraphicsgridlayout.cpp3
-rw-r--r--src/gui/graphicsview/qgraphicslinearlayout.cpp3
2 files changed, 4 insertions, 2 deletions
diff --git a/src/gui/graphicsview/qgraphicsgridlayout.cpp b/src/gui/graphicsview/qgraphicsgridlayout.cpp
index 062b5ac..3fc7f10 100644
--- a/src/gui/graphicsview/qgraphicsgridlayout.cpp
+++ b/src/gui/graphicsview/qgraphicsgridlayout.cpp
@@ -641,7 +641,8 @@ QSizeF QGraphicsGridLayout::sizeHint(Qt::SizeHint which, const QSizeF &constrain
Q_D(const QGraphicsGridLayout);
qreal left, top, right, bottom;
getContentsMargins(&left, &top, &right, &bottom);
- return d->engine.sizeHint(d->styleInfo(), which , constraint) + QSizeF(left + right, top + bottom);
+ const QSizeF extraMargins(left + right, top + bottom);
+ return d->engine.sizeHint(d->styleInfo(), which , constraint - extraMargins) + extraMargins;
}
diff --git a/src/gui/graphicsview/qgraphicslinearlayout.cpp b/src/gui/graphicsview/qgraphicslinearlayout.cpp
index 37408ef..1588364 100644
--- a/src/gui/graphicsview/qgraphicslinearlayout.cpp
+++ b/src/gui/graphicsview/qgraphicslinearlayout.cpp
@@ -528,7 +528,8 @@ QSizeF QGraphicsLinearLayout::sizeHint(Qt::SizeHint which, const QSizeF &constra
Q_D(const QGraphicsLinearLayout);
qreal left, top, right, bottom;
getContentsMargins(&left, &top, &right, &bottom);
- return d->engine.sizeHint(d->styleInfo(), which , constraint) + QSizeF(left + right, top + bottom);
+ const QSizeF extraMargins(left + right, top + bottom);
+ return d->engine.sizeHint(d->styleInfo(), which , constraint - extraMargins) + extraMargins;
}
/*!