summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qlayout.cpp
diff options
context:
space:
mode:
authorJan Arve Saether <jan-arve.saether@digia.com>2013-05-14 09:45:53 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-05-14 17:57:24 +0200
commit27e690e163408dec1e9c56ffc07131354d4b2c8a (patch)
treef9c750f9af9ae25849c81891d61b1c82cb594cd5 /src/widgets/kernel/qlayout.cpp
parent0b862e067756132225e33be09670631edd50d944 (diff)
Respect specified minimum height for menuBar also if it has HFW.
If the menu bar is subject to height for width (HFW) we should of course respect that, but in addition we should ensure that the HFW is within the minimum and maximum height. This also is consistent with how QGridLayout calculates the effective minimum row height. This fixes a regression because change 4780f94e391b5e881497c5228661dead turned QTabWidget into a proper height-for-width citizen, and when setting a QTabWidget as a menuwidget, the buggy codepath for HFW was suddenly hit in menuBarHeightForWidth(). Task-number: QTBUG-31057 Change-Id: I3c1bb8063c92d6eda7e9433e44f08967d8e1c43e Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
Diffstat (limited to 'src/widgets/kernel/qlayout.cpp')
-rw-r--r--src/widgets/kernel/qlayout.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp
index 0402f9939a..a65c34adf5 100644
--- a/src/widgets/kernel/qlayout.cpp
+++ b/src/widgets/kernel/qlayout.cpp
@@ -59,12 +59,10 @@ static int menuBarHeightForWidth(QWidget *menubar, int w)
{
if (menubar && !menubar->isHidden() && !menubar->isWindow()) {
int result = menubar->heightForWidth(qMax(w, menubar->minimumWidth()));
- if (result != -1)
- return result;
- result = menubar->sizeHint()
- .expandedTo(menubar->minimumSize())
- .expandedTo(menubar->minimumSizeHint())
- .boundedTo(menubar->maximumSize()).height();
+ if (result == -1)
+ result = menubar->sizeHint().height();
+ const int min = qSmartMinSize(menubar).height();
+ result = qBound(min, result, menubar->maximumSize().height());
if (result != -1)
return result;
}