Mac: Fix small button metrics, menu indicator alignment
authorGabriel de Dietrich <gabriel.dedietrich@digia.com>
Fri, 30 Nov 2012 15:07:00 +0000 (16:07 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Sat, 1 Dec 2012 07:30:49 +0000 (08:30 +0100)
Task-number: QTBUG-28275
Change-Id: I08de3cc7fee3af725c66ed081072277b2ca32601
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
src/widgets/styles/qmacstyle_mac.mm

index fe7e51b..759b367 100644 (file)
@@ -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<const QStyleOptionMenuItem *>(opt)) {