From 3fadd88f30d7308500b7d6012c45346e9c6f47d0 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 21 Jan 2014 12:59:10 +0100 Subject: [PATCH] Mac Style: Fix non-native menubar item spacing Unfortunate consequence from inheriting from Common style instead of Windows style. Also, a font entry missing in QCocoaTheme. Task-number: QTBUG-36224 Change-Id: I560494b1727734671478f70ee1ba800d21c916ca Reviewed-by: Jens Bache-Wiig --- src/plugins/platforms/cocoa/qcocoasystemsettings.mm | 1 + src/widgets/styles/qmacstyle_mac.mm | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/src/plugins/platforms/cocoa/qcocoasystemsettings.mm b/src/plugins/platforms/cocoa/qcocoasystemsettings.mm index 194394d11a..1c08d4bcb7 100644 --- a/src/plugins/platforms/cocoa/qcocoasystemsettings.mm +++ b/src/plugins/platforms/cocoa/qcocoasystemsettings.mm @@ -254,6 +254,7 @@ QHash qt_mac_createRoleFonts() fonts.insert(QPlatformTheme::ListBoxFont, qt_mac_qfontForThemeFont(kThemeViewsFont)); fonts.insert(QPlatformTheme::TitleBarFont, qt_mac_qfontForThemeFont(kThemeWindowTitleFont)); fonts.insert(QPlatformTheme::MenuFont, qt_mac_qfontForThemeFont(kThemeMenuItemFont)); + fonts.insert(QPlatformTheme::MenuBarFont, qt_mac_qfontForThemeFont(kThemeMenuItemFont)); fonts.insert(QPlatformTheme::ComboMenuItemFont, qt_mac_qfontForThemeFont(kThemeSystemFont)); fonts.insert(QPlatformTheme::HeaderViewFont, qt_mac_qfontForThemeFont(kThemeSmallSystemFont)); fonts.insert(QPlatformTheme::TipLabelFont, qt_mac_qfontForThemeFont(kThemeSmallSystemFont)); diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index d13339b555..fa49bcb884 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -2077,6 +2077,10 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW ret = 0; break; + case PM_MenuBarPanelWidth: + ret = 0; + break; + case QStyle::PM_MenuDesktopFrameWidth: ret = 5; break; @@ -6259,6 +6263,10 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, sz = QSize(w, h); } break; + case CT_MenuBarItem: + if (!sz.isEmpty()) + sz += QSize(12, 4); // Constants from QWindowsStyle + break; case CT_ToolButton: sz.rwidth() += 10; sz.rheight() += 10;