From bc0cbdb9815082901d7aad11cb739615793b2012 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 30 Nov 2012 16:07:00 +0100 Subject: [PATCH] Mac: Fix small button metrics, menu indicator alignment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-28275 Change-Id: I08de3cc7fee3af725c66ed081072277b2ca32601 Reviewed-by: Samuel Rødal --- src/widgets/styles/qmacstyle_mac.mm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index fe7e51b6f6..759b3678d7 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -3553,8 +3553,9 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter if (btn->features & QStyleOptionButton::HasMenu) { int mbi = proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator, btn, w); QRect ir = btn->rect; + int arrowYOffset = bdi.kind == kThemePushButton ? 4 : 2; HIRect arrowRect = CGRectMake(ir.right() - mbi - QMacStylePrivate::PushButtonRightOffset, - ir.height() / 2 - 4, mbi, ir.height() / 2); + ir.height() / 2 - arrowYOffset, mbi, ir.height() / 2); bool drawColorless = btn->palette.currentColorGroup() == QPalette::Active; if (drawColorless && tds == kThemeStateInactive) tds = kThemeStateActive; @@ -6072,7 +6073,10 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, // Do this by add enough space around the contents so that rounded // borders (including highlighting when active) will show. sz.rwidth() += QMacStylePrivate::PushButtonLeftOffset + QMacStylePrivate::PushButtonRightOffset + 12; - sz.rheight() += 4; + if (opt->state & QStyle::State_Small) + sz.rheight() += 14; + else + sz.rheight() += 4; break; case QStyle::CT_MenuItem: if (const QStyleOptionMenuItem *mi = qstyleoption_cast(opt)) {