QWindows11Style: Reduce menubar height in QTabWidget

Due to increased menubar height, an attached menubar to QTabWidgets was
shown as >> indicator. This patch reduces the size of the menubar, in
case it is attached to a QTabWidget.

Fixes: QTBUG-130399
Change-Id: I0e71156cacd6acc51ede353b3b4ddf09d9c0260f
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit 9a06060e9ba0711ed458c19c274b7903f3d89d65)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Wladimir Leuschner 2024-10-23 16:43:48 +02:00 committed by Qt Cherry-pick Bot
parent 1791b5461d
commit d3f26e2bbd

View File

@ -24,6 +24,9 @@
#if QT_CONFIG(datetimeedit)
# include <QtWidgets/qdatetimeedit.h>
#endif
#if QT_CONFIG(tabwidget)
# include <QtWidgets/qtabwidget.h>
#endif
#include "qdrawutil.h"
#include <chrono>
@ -2000,7 +2003,10 @@ QSize QWindows11Style::sizeFromContents(ContentsType type, const QStyleOption *o
constexpr int hPadding = 2 * 11;
constexpr int itemHeight = 32;
contentSize.setWidth(contentSize.width() + hMargin + hPadding);
contentSize.setHeight(itemHeight);
#if QT_CONFIG(tabwidget)
if (widget->parent() && !qobject_cast<const QTabWidget *>(widget->parent()))
#endif
contentSize.setHeight(itemHeight);
}
break;
#endif