From 3fbdb31420ffd37abbd36e45956970e23c510b13 Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Thu, 24 Apr 2025 13:49:54 +0200 Subject: [PATCH] macOS: respect strikeout attribute in menu item fonts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When we draw menu item text with CoreText instead of QPainter, then we need to translate QFont::strikeOut() explicitly to an entry in the attribute dictionary. Task-number: QTBUG-136215 Change-Id: Ic4a895cd10c950c477acffca0078718490f4f0b7 Reviewed-by: Tor Arne Vestbø --- src/plugins/styles/mac/qmacstyle_mac.mm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm index 749a4484a9c..bc411eb72d8 100644 --- a/src/plugins/styles/mac/qmacstyle_mac.mm +++ b/src/plugins/styles/mac/qmacstyle_mac.mm @@ -4289,7 +4289,9 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter withAttributes:@{ NSFontAttributeName:f, NSForegroundColorAttributeName:c, NSObliquenessAttributeName: [NSNumber numberWithDouble: myFont.italic() ? 0.3 : 0.0], NSUnderlineStyleAttributeName: [NSNumber numberWithInt: myFont.underline() ? NSUnderlineStyleSingle - : NSUnderlineStyleNone]}]; + : NSUnderlineStyleNone], + NSStrikethroughStyleAttributeName: [NSNumber numberWithInt: myFont.strikeOut() ? NSUnderlineStyleSingle + : NSUnderlineStyleNone]}]; d->restoreNSGraphicsContext(cgCtx); } else {