From d3f26e2bbdb7941ad4422dbe31bca1160bbe4adf Mon Sep 17 00:00:00 2001 From: Wladimir Leuschner Date: Wed, 23 Oct 2024 16:43:48 +0200 Subject: [PATCH] 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 (cherry picked from commit 9a06060e9ba0711ed458c19c274b7903f3d89d65) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/styles/modernwindows/qwindows11style.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/plugins/styles/modernwindows/qwindows11style.cpp b/src/plugins/styles/modernwindows/qwindows11style.cpp index 66b1ae4f544..53f6051d06e 100644 --- a/src/plugins/styles/modernwindows/qwindows11style.cpp +++ b/src/plugins/styles/modernwindows/qwindows11style.cpp @@ -24,6 +24,9 @@ #if QT_CONFIG(datetimeedit) # include #endif +#if QT_CONFIG(tabwidget) +# include +#endif #include "qdrawutil.h" #include @@ -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(widget->parent())) +#endif + contentSize.setHeight(itemHeight); } break; #endif