diff options
author | Christian Ehrlicher <[email protected]> | 2025-04-30 10:26:56 +0200 |
---|---|---|
committer | Christian Ehrlicher <[email protected]> | 2025-05-01 00:58:34 +0200 |
commit | 33c2931429ea0557607627ec452b093d273a9f95 (patch) | |
tree | 4861255b1a9866187bfa6c742a968d6bbbf72f48 | |
parent | 2b7ecfab7d8cb149ffc02285906f95906f2f1343 (diff) |
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.
Pick-to: 6.9
Change-Id: I5fa19ab955d9794aa3d344ba0cfc8a0a3d22b61e
Reviewed-by: Axel Spoerl <[email protected]>
-rw-r--r-- | src/widgets/kernel/qlayout.cpp | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp index a826ea75bc6..263f3feb565 100644 --- a/src/widgets/kernel/qlayout.cpp +++ b/src/widgets/kernel/qlayout.cpp @@ -504,10 +504,8 @@ void QLayoutPrivate::doResize() const int mbTop = rect.top(); rect.setTop(mbTop + mbh); q->setGeometry(rect); -#if QT_CONFIG(menubar) if (menubar) menubar->setGeometry(rect.left(), mbTop, rect.width(), mbh); -#endif } @@ -537,10 +535,8 @@ void QLayout::widgetEvent(QEvent *e) QObject *child = c->child(); QObjectPrivate *op = QObjectPrivate::get(child); if (op->wasWidget) { -#if QT_CONFIG(menubar) if (child == d->menubar) d->menubar = nullptr; -#endif removeWidgetRecursively(this, child); } } @@ -585,10 +581,8 @@ int QLayout::totalMinimumHeightForWidth(int w) const 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 + int h = minimumHeightForWidth(w - side) + top + + menuBarHeightForWidth(d->menubar, w); return h; } @@ -607,10 +601,8 @@ int QLayout::totalHeightForWidth(int w) const side += wd->leftmargin + wd->rightmargin; top += wd->topmargin + wd->bottommargin; } - int h = heightForWidth(w - side) + top; -#if QT_CONFIG(menubar) - h += menuBarHeightForWidth(d->menubar, w); -#endif + int h = heightForWidth(w - side) + top + + menuBarHeightForWidth(d->menubar, w); return h; } @@ -631,9 +623,7 @@ QSize QLayout::totalMinimumSize() const } QSize s = minimumSize(); -#if QT_CONFIG(menubar) top += menuBarHeightForWidth(d->menubar, s.width() + side); -#endif return s + QSize(side, top); } @@ -656,9 +646,7 @@ QSize QLayout::totalSizeHint() const QSize s = sizeHint(); if (hasHeightForWidth()) s.setHeight(heightForWidth(s.width() + side)); -#if QT_CONFIG(menubar) top += menuBarHeightForWidth(d->menubar, s.width()); -#endif return s + QSize(side, top); } @@ -679,9 +667,7 @@ QSize QLayout::totalMaximumSize() const } QSize s = maximumSize(); -#if QT_CONFIG(menubar) top += menuBarHeightForWidth(d->menubar, s.width()); -#endif if (d->topLevel) s = QSize(qMin(s.width() + side, QLAYOUTSIZE_MAX), @@ -757,11 +743,9 @@ void QLayoutPrivate::reparentChildWidgets(QWidget *mw) Q_Q(QLayout); int n = q->count(); -#if QT_CONFIG(menubar) - if (menubar && menubar->parentWidget() != mw) { + if (menubar && menubar->parentWidget() != mw) menubar->setParent(mw); - } -#endif + bool mwVisible = mw && mw->isVisible(); for (int i = 0; i < n; ++i) { QLayoutItem *item = q->itemAt(i); |