summaryrefslogtreecommitdiff
path: root/src/layouts
diff options
context:
space:
mode:
authorJan Arve Saether <jan-arve.saether@digia.com>2013-10-01 11:23:47 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-01 12:06:28 +0200
commit66fb8dd12189232a41164f0f6681699900ef2f3a (patch)
tree3bf425a3d9ae1413c2506f811d15a5574acb71d6 /src/layouts
parentdf4fbe3bf0383903288883f6ea9df6566946f406 (diff)
downloadqtquickcontrols-66fb8dd12189232a41164f0f6681699900ef2f3a.tar.gz
Don't apply baseline calculations if Qt.AlignBaseline is not set
Parts of the code assumed that if q_minimumDescent or q_minimumAscent was valid, it would reserve enough space in each case for the combined ascents and descents of all items in a row. The extreme case was when one item had a baseline at its bottom edge, and the next item had the baseline at its top edge, the layouts minimum height tried to reserve space for such a case even though baseline alignment was not desired. The last case in the test demonstrates such a (valid) case. The problem was that the same logic was applied to the first case. Change-Id: Ie24503b1a5f7333f16ed84ebe01ab8d48becb4e2 Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Diffstat (limited to 'src/layouts')
-rw-r--r--src/layouts/qgridlayoutengine.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/layouts/qgridlayoutengine.cpp b/src/layouts/qgridlayoutengine.cpp
index a06879c9..910e34a0 100644
--- a/src/layouts/qgridlayoutengine.cpp
+++ b/src/layouts/qgridlayoutengine.cpp
@@ -609,11 +609,13 @@ QGridLayoutBox QGridLayoutItem::box(Qt::Orientation orientation, qreal constrain
result.q_maximumSize = result.q_preferredSize;
}
- result.q_minimumDescent = sizeHint(Qt::MinimumDescent, constraintSize).height();
- if (result.q_minimumDescent != -1.0) {
- const qreal minSizeHint = sizeHint(Qt::MinimumSize, constraintSize).height();
- result.q_minimumDescent -= (minSizeHint - result.q_minimumSize);
- result.q_minimumAscent = result.q_minimumSize - result.q_minimumDescent;
+ if (alignment() & Qt::AlignBaseline) {
+ result.q_minimumDescent = sizeHint(Qt::MinimumDescent, constraintSize).height();
+ if (result.q_minimumDescent != -1.0) {
+ const qreal minSizeHint = sizeHint(Qt::MinimumSize, constraintSize).height();
+ result.q_minimumDescent -= (minSizeHint - result.q_minimumSize);
+ result.q_minimumAscent = result.q_minimumSize - result.q_minimumDescent;
+ }
}
}
if (policy & QLayoutPolicy::IgnoreFlag)