summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorJan Arve Saether <jan-arve.saether@digia.com>2013-11-13 10:35:17 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-15 09:15:13 +0100
commitde5b3780cf57154c0ae3bc59e125c12904856ae4 (patch)
treed513f5aec8b3df3a001a48a04ae7bce98ef1e0d3 /src/widgets
parent191f96cb8817a6d1632331c67f4f8d45535205e1 (diff)
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 <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/kernel/qformlayout.cpp2
1 files changed, 1 insertions, 1 deletions
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)