QLaoyut: remove check for QT_CONFIG(menubar)

Even though the member is named 'menuBar', it's a plain QWidget. Also
the setter are not guarded so the functionality should not be guarded
too.

Change-Id: I5fa19ab955d9794aa3d344ba0cfc8a0a3d22b61e
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 33c2931429ea0557607627ec452b093d273a9f95)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Christian Ehrlicher 2025-04-30 10:26:56 +02:00 committed by Qt Cherry-pick Bot
parent 179474de31
commit 29688402ce

View File

@ -504,10 +504,8 @@ void QLayoutPrivate::doResize()
const int mbTop = rect.top(); const int mbTop = rect.top();
rect.setTop(mbTop + mbh); rect.setTop(mbTop + mbh);
q->setGeometry(rect); q->setGeometry(rect);
#if QT_CONFIG(menubar)
if (menubar) if (menubar)
menubar->setGeometry(rect.left(), mbTop, rect.width(), mbh); menubar->setGeometry(rect.left(), mbTop, rect.width(), mbh);
#endif
} }
@ -537,10 +535,8 @@ void QLayout::widgetEvent(QEvent *e)
QObject *child = c->child(); QObject *child = c->child();
QObjectPrivate *op = QObjectPrivate::get(child); QObjectPrivate *op = QObjectPrivate::get(child);
if (op->wasWidget) { if (op->wasWidget) {
#if QT_CONFIG(menubar)
if (child == d->menubar) if (child == d->menubar)
d->menubar = nullptr; d->menubar = nullptr;
#endif
removeWidgetRecursively(this, child); removeWidgetRecursively(this, child);
} }
} }
@ -585,10 +581,8 @@ int QLayout::totalMinimumHeightForWidth(int w) const
side += wd->leftmargin + wd->rightmargin; side += wd->leftmargin + wd->rightmargin;
top += wd->topmargin + wd->bottommargin; top += wd->topmargin + wd->bottommargin;
} }
int h = minimumHeightForWidth(w - side) + top; int h = minimumHeightForWidth(w - side) + top +
#if QT_CONFIG(menubar) menuBarHeightForWidth(d->menubar, w);
h += menuBarHeightForWidth(d->menubar, w);
#endif
return h; return h;
} }
@ -607,10 +601,8 @@ int QLayout::totalHeightForWidth(int w) const
side += wd->leftmargin + wd->rightmargin; side += wd->leftmargin + wd->rightmargin;
top += wd->topmargin + wd->bottommargin; top += wd->topmargin + wd->bottommargin;
} }
int h = heightForWidth(w - side) + top; int h = heightForWidth(w - side) + top +
#if QT_CONFIG(menubar) menuBarHeightForWidth(d->menubar, w);
h += menuBarHeightForWidth(d->menubar, w);
#endif
return h; return h;
} }
@ -631,9 +623,7 @@ QSize QLayout::totalMinimumSize() const
} }
QSize s = minimumSize(); QSize s = minimumSize();
#if QT_CONFIG(menubar)
top += menuBarHeightForWidth(d->menubar, s.width() + side); top += menuBarHeightForWidth(d->menubar, s.width() + side);
#endif
return s + QSize(side, top); return s + QSize(side, top);
} }
@ -656,9 +646,7 @@ QSize QLayout::totalSizeHint() const
QSize s = sizeHint(); QSize s = sizeHint();
if (hasHeightForWidth()) if (hasHeightForWidth())
s.setHeight(heightForWidth(s.width() + side)); s.setHeight(heightForWidth(s.width() + side));
#if QT_CONFIG(menubar)
top += menuBarHeightForWidth(d->menubar, s.width()); top += menuBarHeightForWidth(d->menubar, s.width());
#endif
return s + QSize(side, top); return s + QSize(side, top);
} }
@ -679,9 +667,7 @@ QSize QLayout::totalMaximumSize() const
} }
QSize s = maximumSize(); QSize s = maximumSize();
#if QT_CONFIG(menubar)
top += menuBarHeightForWidth(d->menubar, s.width()); top += menuBarHeightForWidth(d->menubar, s.width());
#endif
if (d->topLevel) if (d->topLevel)
s = QSize(qMin(s.width() + side, QLAYOUTSIZE_MAX), s = QSize(qMin(s.width() + side, QLAYOUTSIZE_MAX),
@ -757,11 +743,9 @@ void QLayoutPrivate::reparentChildWidgets(QWidget *mw)
Q_Q(QLayout); Q_Q(QLayout);
int n = q->count(); int n = q->count();
#if QT_CONFIG(menubar) if (menubar && menubar->parentWidget() != mw)
if (menubar && menubar->parentWidget() != mw) {
menubar->setParent(mw); menubar->setParent(mw);
}
#endif
bool mwVisible = mw && mw->isVisible(); bool mwVisible = mw && mw->isVisible();
for (int i = 0; i < n; ++i) { for (int i = 0; i < n; ++i) {
QLayoutItem *item = q->itemAt(i); QLayoutItem *item = q->itemAt(i);