summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoamenuitem.mm
diff options
context:
space:
mode:
authorTimur Pocheptsov <timur.pocheptsov@qt.io>2018-10-18 10:39:18 +0200
committerTimur Pocheptsov <timur.pocheptsov@qt.io>2018-10-19 10:54:29 +0000
commit5760545ebb5961015e1d2d19a3713ff1d08f91e5 (patch)
treeb04580b8da0a5f33fe32230d0e82a050bcac781e /src/plugins/platforms/cocoa/qcocoamenuitem.mm
parentb88eaa255a4646446e0842f3d8f732b39d09a65f (diff)
QCocoaMenuItem: ignore font hints
Native applications do not use custom fonts in menus, so we should avoid it - our own example app 'menus' demonstrates the problem. To quote Gabriel: Although the Mac HIG don't say that you shouldn't, and there's even a API to do it (which we're obviously not using properly), the truth is that nobody does it. Simply put, it looks wrong on Mac (although it's arguable whether it looks good or bad regardless of the platform). Task-number: QTBUG-29654 Change-Id: Iffd08ad63d419164102b2e738cdf1ebda1967a05 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoamenuitem.mm')
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuitem.mm18
1 files changed, 2 insertions, 16 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.mm b/src/plugins/platforms/cocoa/qcocoamenuitem.mm
index 21faa6d985..e54b6284e5 100644
--- a/src/plugins/platforms/cocoa/qcocoamenuitem.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenuitem.mm
@@ -173,7 +173,7 @@ void QCocoaMenuItem::setIsSeparator(bool isSeparator)
void QCocoaMenuItem::setFont(const QFont &font)
{
- m_font = font;
+ Q_UNUSED(font)
}
void QCocoaMenuItem::setRole(MenuRole role)
@@ -319,21 +319,7 @@ NSMenuItem *QCocoaMenuItem::sync()
text += QLatin1String(" (") + accel.toString(QKeySequence::NativeText) + QLatin1String(")");
#endif
- QString finalString = QPlatformTheme::removeMnemonics(text);
- bool useAttributedTitle = false;
- // Cocoa Font and title
- if (m_font.resolve()) {
- NSFont *customMenuFont = [NSFont fontWithName:m_font.family().toNSString()
- size:m_font.pointSize()];
- if (customMenuFont) {
- NSAttributedString *str = [[[NSAttributedString alloc] initWithString:finalString.toNSString()
- attributes:@{NSFontAttributeName: customMenuFont}] autorelease];
- m_native.attributedTitle = str;
- useAttributedTitle = true;
- }
- }
- if (!useAttributedTitle)
- m_native.title = finalString.toNSString();
+ m_native.title = QPlatformTheme::removeMnemonics(text).toNSString();
#ifndef QT_NO_SHORTCUT
if (accel.count() == 1) {