diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2021-05-27 11:44:30 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-05-28 15:32:17 +0000 |
commit | 0096d1545bc85dbd0556014d4fbbeba77d4fd5b4 (patch) | |
tree | 2f155137c46635f3ce97ec9b852659fa4d2608ff | |
parent | 82878f08e64aec460d4c45533c2e0f1bc485b3ac (diff) |
macOS: respect underline attribute in menu item fonts
When we draw menu item text with CoreText instead of QPainter, then we
need to translate QFont::underline() explicitly to an entry in the
attribute dictionary.
Task-number: QTBUG-73990
Change-Id: I7e0c258f7cf80a89b29517fa8122576342654de1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 5ac479f5990a4c2b09ea34fb98d10c17d405aa5e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/plugins/styles/mac/qmacstyle_mac.mm | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm index 8c159e4107..22cf75f12b 100644 --- a/src/plugins/styles/mac/qmacstyle_mac.mm +++ b/src/plugins/styles/mac/qmacstyle_mac.mm @@ -4380,8 +4380,10 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter // line-break the string if it doesn't fit the given rect. It's better to draw outside // the rect and possibly overlap something than to have part of the text disappear. [s.toNSString() drawAtPoint:CGPointMake(xpos, yPos) - withAttributes:@{ NSFontAttributeName:f, NSForegroundColorAttributeName:c, - NSObliquenessAttributeName: [NSNumber numberWithDouble: myFont.italic() ? 0.3 : 0.0]}]; + withAttributes:@{ NSFontAttributeName:f, NSForegroundColorAttributeName:c, + NSObliquenessAttributeName: [NSNumber numberWithDouble: myFont.italic() ? 0.3 : 0.0], + NSUnderlineStyleAttributeName: [NSNumber numberWithInt: myFont.underline() ? NSUnderlineStyleSingle + : NSUnderlineStyleNone]}]; d->restoreNSGraphicsContext(cgCtx); } else { |