Mac: Fix small button metrics, menu indicator alignment

Task-number: QTBUG-28275
Change-Id: I08de3cc7fee3af725c66ed081072277b2ca32601
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
This commit is contained in:
Gabriel de Dietrich 2012-11-30 16:07:00 +01:00 committed by The Qt Project
parent 95a05904b9
commit bc0cbdb981

View File

@ -3553,8 +3553,9 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
if (btn->features & QStyleOptionButton::HasMenu) { if (btn->features & QStyleOptionButton::HasMenu) {
int mbi = proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator, btn, w); int mbi = proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator, btn, w);
QRect ir = btn->rect; QRect ir = btn->rect;
int arrowYOffset = bdi.kind == kThemePushButton ? 4 : 2;
HIRect arrowRect = CGRectMake(ir.right() - mbi - QMacStylePrivate::PushButtonRightOffset, 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; bool drawColorless = btn->palette.currentColorGroup() == QPalette::Active;
if (drawColorless && tds == kThemeStateInactive) if (drawColorless && tds == kThemeStateInactive)
tds = kThemeStateActive; 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 // Do this by add enough space around the contents so that rounded
// borders (including highlighting when active) will show. // borders (including highlighting when active) will show.
sz.rwidth() += QMacStylePrivate::PushButtonLeftOffset + QMacStylePrivate::PushButtonRightOffset + 12; sz.rwidth() += QMacStylePrivate::PushButtonLeftOffset + QMacStylePrivate::PushButtonRightOffset + 12;
sz.rheight() += 4; if (opt->state & QStyle::State_Small)
sz.rheight() += 14;
else
sz.rheight() += 4;
break; break;
case QStyle::CT_MenuItem: case QStyle::CT_MenuItem:
if (const QStyleOptionMenuItem *mi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) { if (const QStyleOptionMenuItem *mi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {