QMacStyle: Remove CT_ToolButton related dead code

sizeFromContents() just adds 10 points to the tool button
size and returns. Therefore, the HITheme code that used
to be shared with CT_PushButton becomes effectively dead.

Change-Id: Ib0519b0037ec3097a00e2c14067d851040853499
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
Gabriel de Dietrich 2018-03-20 11:00:38 -07:00
parent 50428e9727
commit 76bec0c49a

View File

@ -6487,35 +6487,6 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
const CGRect diffRect = QMacStylePrivate::comboboxInnerBounds(CGRectZero, cw);
sz.rwidth() -= qRound(diffRect.size.width);
sz.rheight() -= qRound(diffRect.size.height);
} else if (ct == CT_ToolButton){
ThemeButtonKind bkind;
QStyleHelper::WidgetSizePolicy widgetSize = d->aquaSizeConstrain(opt, widget);
switch (widgetSize) {
case QStyleHelper::SizeDefault:
case QStyleHelper::SizeLarge:
bkind = kThemeLargeBevelButton;
break;
case QStyleHelper::SizeMini:
case QStyleHelper::SizeSmall:
bkind = kThemeSmallBevelButton;
}
HIThemeButtonDrawInfo bdi;
bdi.version = qt_mac_hitheme_version;
bdi.state = kThemeStateActive;
bdi.kind = bkind;
bdi.value = kThemeButtonOff;
bdi.adornment = kThemeAdornmentNone;
CGRect macRect, myRect;
myRect = CGRectMake(0, 0, sz.width(), sz.height());
HIThemeGetButtonBackgroundBounds(&myRect, &bdi, &macRect);
// Mini buttons only return their actual size in HIThemeGetButtonBackgroundBounds, so help them out a bit (guess),
if (bkind == kThemePushButtonMini)
macRect.size.height += 8.;
else if (bkind == kThemePushButtonSmall)
macRect.size.height -= 10;
sz.setWidth(sz.width() + int(macRect.size.width - myRect.size.width));
sz.setHeight(sz.height() + int(macRect.size.height - myRect.size.height));
}
return sz;
}