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; }