diff options
author | Jan Arve Saether <jan-arve.saether@digia.com> | 2013-05-14 07:45:53 (GMT) |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-05-15 23:31:57 (GMT) |
commit | 5eafca5efbc29d86dac0e643e99017d8355b4e31 (patch) | |
tree | 1a8e555d1d05802a2c270296fd84b0847eb1d4d0 /src/gui/kernel | |
parent | 0463c1e6cd26e4b88f433a5598d1bd1544a59212 (diff) | |
download | Qt-5eafca5efbc29d86dac0e643e99017d8355b4e31.zip Qt-5eafca5efbc29d86dac0e643e99017d8355b4e31.tar.gz Qt-5eafca5efbc29d86dac0e643e99017d8355b4e31.tar.bz2 |
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
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
(cherry picked from qtbase/27e690e163408dec1e9c56ffc07131354d4b2c8a)
Change-Id: I915d37c69152c1804925000303e82a3fae5a9a47
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qlayout.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/gui/kernel/qlayout.cpp b/src/gui/kernel/qlayout.cpp index ce8322b..9aca81e 100644 --- a/src/gui/kernel/qlayout.cpp +++ b/src/gui/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; } |