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
Pick-to: 6.8
Change-Id: I0e71156cacd6acc51ede353b3b4ddf09d9c0260f
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
This commit is contained in:
Wladimir Leuschner 2024-10-23 16:43:48 +02:00
parent e5f9738385
commit 9a06060e9b

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>
@ -2030,7 +2033,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