Support negative layout spacings (do not assert)

This tests
* default spacing
* explicit positive spacing
* negative spacings

Negative spacings that causes the layout to shrink down to 0 or
a negative spacing are not supported.
(But make sure they don't crash the whole engine)

This is a partial cherry picked from
qtquickcontrols.git/bc973dcf2163b25f2db74d974b252384bbee8d80)

Only the Q_ASSERT had to be cherry-picked. This is because of that the
qgridlayoutengine* is moved to qtbase.
Therefore, any changes to qgridlayoutengine* won't be merged properly to
dev (they will be lost).

Task-number: QTBUG-35741
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>

Change-Id: I834f1efc11aca59a93c8d870f1a776f2f8810485
Reviewed-by: Caroline Chao <caroline.chao@digia.com>
This commit is contained in:
Jan Arve Saether 2014-01-21 09:57:50 +01:00 committed by The Qt Project
parent db51ffc0d1
commit 7ddd813b7f

View File

@ -805,7 +805,6 @@ int QGridLayoutEngine::effectiveLastRow(Qt::Orientation orientation) const
void QGridLayoutEngine::setSpacing(qreal spacing, Qt::Orientations orientations)
{
Q_ASSERT(spacing >= 0.0);
if (orientations & Qt::Horizontal)
q_defaultSpacings[Hor].setUserValue(spacing);
if (orientations & Qt::Vertical)