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.8
Change-Id: I25c9b993450e7fe740addb153259f46b570ad8f7
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 1c26a93b3d5cccd48d18ef2e8b1879c093c15794)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Christian Ehrlicher 2025-03-17 19:54:34 +01:00 committed by Qt Cherry-pick Bot
parent b3f39fdd55
commit 438516cf34

View File

@ -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