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