summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2017-08-17 11:31:27 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2017-08-18 07:27:52 +0000
commitb5d762ae87e8f3a35a84a6c7d6d324c27d487a8c (patch)
tree2701db995a0e30d3e05fba0ce7989b80978a3028 /src
parent362466c7d2e12c4587d5de1eb51cd537be9f7e2b (diff)
macOS: Fix padding around tab label with icon
Change c12072c685f7e93d5b84e289ca23106482379eff fixed a problem where tab labels would overlap with the icons if the tab became too small to contain the text. But it did not properly account for the full area occupied by the icon, because the horizontal padding is hardcoded to 4 in the mac style, whereas in the common style (where the icon is drawn) it uses the pixel metric for this. In addition, the change only allocated space on the left side, causing the label to no longer be centered. Task-number: QTBUG-61235 Change-Id: Ieec4f7044584361f92045addbc8bbd81bd5c9fc7 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index b5d1fff5e7..d9eeb2c83b 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -1142,7 +1142,12 @@ void QMacStylePrivate::tabLayout(const QStyleOptionTab *opt, const QWidget *widg
tabIconSize.width(), tabIconSize.height());
if (!verticalTabs)
*iconRect = proxyStyle->visualRect(opt->direction, opt->rect, *iconRect);
- tr.setLeft(tr.left() + tabIconSize.width() + 4);
+
+ int stylePadding = proxyStyle->pixelMetric(QStyle::PM_TabBarTabHSpace, opt, widget) / 2;
+ stylePadding -= hpadding;
+
+ tr.setLeft(tr.left() + stylePadding + tabIconSize.width() + 4);
+ tr.setRight(tr.right() - stylePadding - tabIconSize.width() - 4);
}
if (!verticalTabs)