From de5b3780cf57154c0ae3bc59e125c12904856ae4 Mon Sep 17 00:00:00 2001 From: Jan Arve Saether Date: Wed, 13 Nov 2013 10:35:17 +0100 Subject: QFormLayout: Avoid assertion with negative spacings. It's not really clear if styles *must* return a non-negative value for QStyle::pixelMetric(PM_Layout{Vertical,Horizontal}Spacing), but both QBoxLayout and QGridLayout seems to be robust enough to handle this. They will simply make sure that the spacing is never negative. We therefore make QFormLayout equally robust. Task-number: QTBUG-34731 Change-Id: I62235bfcd8adf7757cf15bc9927b29650ae6459d Reviewed-by: Friedemann Kleint --- src/widgets/kernel/qformlayout.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets/kernel') diff --git a/src/widgets/kernel/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp index e1376c754f..c1d3e95e7a 100644 --- a/src/widgets/kernel/qformlayout.cpp +++ b/src/widgets/kernel/qformlayout.cpp @@ -641,7 +641,7 @@ static inline int spacingHelper(QWidget* parent, QStyle *style, int userVSpacing spacing = qMax(spacing, prevItem2->geometry().top() - wid->geometry().top() ); } } - return spacing; + return qMax(spacing, 0); } static inline void initLayoutStruct(QLayoutStruct& sl, QFormLayoutItem* item) -- cgit v1.2.3