summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qlayout.cpp
diff options
context:
space:
mode:
authorJan Arve Sæther <jan-arve.saether@qt.io>2021-05-07 11:38:24 +0200
committerJan Arve Sæther <jan-arve.saether@qt.io>2021-05-10 08:24:13 +0000
commit4d4eb11fe340bf0b3a1ce0caae62d9319bf941cf (patch)
treef2c13d3ae331063ae79e5a2777f5ae2a441dfaf6 /src/widgets/kernel/qlayout.cpp
parent036c13a0f48ea964da36c6ac01b379d9aa52fdc1 (diff)
Improve handling of minimumHeightForWidth()
This also aligns the implementation with QWidgetItem::heightForWidth() Fixes: QTBUG-92599 Pick-to: 5.15 6.1 Change-Id: I0de68c61ec37a16a8c338575d07ff9e8168a0b98 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src/widgets/kernel/qlayout.cpp')
-rw-r--r--src/widgets/kernel/qlayout.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp
index 39c7f7ec3f..8688e011a0 100644
--- a/src/widgets/kernel/qlayout.cpp
+++ b/src/widgets/kernel/qlayout.cpp
@@ -608,6 +608,28 @@ void QLayout::childEvent(QChildEvent *e)
\internal
Also takes contentsMargins and menu bar into account.
*/
+int QLayout::totalMinimumHeightForWidth(int w) const
+{
+ Q_D(const QLayout);
+ int side=0, top=0;
+ if (d->topLevel) {
+ QWidget *parent = parentWidget();
+ parent->ensurePolished();
+ QWidgetPrivate *wd = parent->d_func();
+ side += wd->leftmargin + wd->rightmargin;
+ top += wd->topmargin + wd->bottommargin;
+ }
+ int h = minimumHeightForWidth(w - side) + top;
+#if QT_CONFIG(menubar)
+ h += menuBarHeightForWidth(d->menubar, w);
+#endif
+ return h;
+}
+
+/*!
+ \internal
+ Also takes contentsMargins and menu bar into account.
+*/
int QLayout::totalHeightForWidth(int w) const
{
Q_D(const QLayout);