From 1c26a93b3d5cccd48d18ef2e8b1879c093c15794 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Mon, 17 Mar 2025 19:54:34 +0100 Subject: [PATCH] Windows11Style: Use correct font when a pushbutton has a menu When a pushbutton has a menu, the menu indicator is drawn as the glyph ChevronDown from Segoe Fluent Icons font. But later the font is not reset so it's also used for the push buttons label. Since the icon font has no valid glyphs for most of the characters, a replacement is used but this might not be the one set for the pushbutton. Pick-to: 6.9 6.8 Change-Id: I25c9b993450e7fe740addb153259f46b570ad8f7 Reviewed-by: Axel Spoerl --- src/plugins/styles/modernwindows/qwindows11style.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/styles/modernwindows/qwindows11style.cpp b/src/plugins/styles/modernwindows/qwindows11style.cpp index 26ef3c2b9a2..53848f1698a 100644 --- a/src/plugins/styles/modernwindows/qwindows11style.cpp +++ b/src/plugins/styles/modernwindows/qwindows11style.cpp @@ -1390,6 +1390,7 @@ void QWindows11Style::drawControl(ControlElement element, const QStyleOption *op int indicatorSize = proxy()->pixelMetric(PM_MenuButtonIndicator, btn, widget); QLineF menuSplitter; QRectF indicatorRect; + painter->save(); painter->setFont(assetFont); if (btn->direction == Qt::LeftToRight) { @@ -1406,6 +1407,7 @@ void QWindows11Style::drawControl(ControlElement element, const QStyleOption *op painter->drawText(indicatorRect, QStringLiteral(u"\uE70D"), Qt::AlignVCenter | Qt::AlignHCenter); painter->setPen(WINUI3Colors[colorSchemeIndex][controlStrokePrimary]); painter->drawLine(menuSplitter); + painter->restore(); } if (!btn->icon.isNull()) { //Center both icon and text