QMacStyle: fix QTabBar tab size

A few small visual issues were introduced during recent QTabBar
restyling (see 175f33ed85)

Change-Id: Ifab8b9f24e2cad6e1a827b1061471882a1bc9f5e
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
This commit is contained in:
Oleg Yadrov 2017-03-10 13:52:29 -08:00
parent df40b1115d
commit 63a39927a0

View File

@ -1076,11 +1076,6 @@ void QMacStylePrivate::tabLayout(const QStyleOptionTab *opt, const QWidget *widg
if (opt->shape == QTabBar::RoundedSouth || opt->shape == QTabBar::TriangularSouth)
verticalShift = -verticalShift;
tr.adjust(hpadding, verticalShift - vpadding, horizontalShift - hpadding, vpadding);
const bool selected = opt->state & QStyle::State_Selected;
if (selected) {
tr.setTop(tr.top() - verticalShift);
tr.setRight(tr.right() - horizontalShift);
}
// left widget
if (!opt->leftButtonSize.isEmpty()) {
@ -2488,7 +2483,7 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW
case QAquaSizeUnknown:
const QStyleOptionTab *tb = qstyleoption_cast<const QStyleOptionTab *>(opt);
if (tb && tb->documentMode)
ret = 24;
ret = 30;
else
ret = QCommonStyle::pixelMetric(metric, opt, widget);
break;
@ -6610,7 +6605,6 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
sz = sz.transposed();
int defaultTabHeight;
int extraHSpace = proxy()->pixelMetric(PM_TabBarTabHSpace, tab, widget);
int extraVSpace = proxy()->pixelMetric(PM_TabBarTabVSpace, tab, widget);
QFontMetrics fm = opt->fontMetrics;
switch (AquaSize) {
case QAquaSizeUnknown:
@ -6630,13 +6624,13 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
bool setWidth = false;
if (differentFont || !tab->icon.isNull()) {
sz.rheight() = qMax(defaultTabHeight, sz.height());
sz.rwidth() += extraHSpace;
} else {
QSize textSize = fm.size(Qt::TextShowMnemonic, tab->text);
sz.rheight() = qMax(defaultTabHeight, textSize.height());
sz.rwidth() = textSize.width() + extraVSpace;
sz.rwidth() = textSize.width();
setWidth = true;
}
sz.rwidth() += extraHSpace;
if (vertTabs)
sz = sz.transposed();