diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-08-27 13:04:30 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-08-27 14:55:31 (GMT) |
commit | de1f8b826fafccd9a528a000cf99d6a1f553855b (patch) | |
tree | 4baebad9c166d4ead43474b99f756db4ff3059e6 /src/gui/styles | |
parent | 8dd8090f5f5c4bfddef87d9244a353f42ddf9db4 (diff) | |
download | Qt-de1f8b826fafccd9a528a000cf99d6a1f553855b.zip Qt-de1f8b826fafccd9a528a000cf99d6a1f553855b.tar.gz Qt-de1f8b826fafccd9a528a000cf99d6a1f553855b.tar.bz2 |
QTabBar: Fix the position of button in tabs.
Use the PM_TabBarTabHSpace instead of the hardcoded '6'
Use a spacing of 4px instead of 2px between the buttons and the text.
Reviewed-by: jbache
Diffstat (limited to 'src/gui/styles')
-rw-r--r-- | src/gui/styles/qcommonstyle.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index 9dee6eb..ee9827e 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -1191,12 +1191,12 @@ void QCommonStylePrivate::tabLayout(const QStyleOptionTabV3 *opt, const QWidget // left widget if (!opt->leftButtonSize.isEmpty()) { - tr.setLeft(tr.left() + 6 + 2 + + tr.setLeft(tr.left() + 4 + (verticalTabs ? opt->leftButtonSize.height() : opt->leftButtonSize.width())); } // right widget if (!opt->rightButtonSize.isEmpty()) { - tr.setRight(tr.right() - 6 - 2 - + tr.setRight(tr.right() - 4 - (verticalTabs ? opt->rightButtonSize.height() : opt->rightButtonSize.width())); } @@ -2780,6 +2780,8 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, bool selected = tab->state & State_Selected; int verticalShift = proxy()->pixelMetric(QStyle::PM_TabBarTabShiftVertical, tab, widget); int horizontalShift = proxy()->pixelMetric(QStyle::PM_TabBarTabShiftHorizontal, tab, widget); + int hpadding = proxy()->pixelMetric(QStyle::PM_TabBarTabHSpace, opt, widget) / 2; + hpadding = qMax(hpadding, 4); //workaround KStyle returning 0 because they workaround an old bug in Qt bool verticalTabs = tab->shape == QTabBar::RoundedEast || tab->shape == QTabBar::RoundedWest @@ -2822,16 +2824,16 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, break; default: if (sr == SE_TabBarTabLeftButton) - r = QRect(6 + tab->rect.x(), midHeight, w, h); + r = QRect(tab->rect.x() + hpadding, midHeight, w, h); else - r = QRect(tab->rect.right() - 6 - w, midHeight, w, h); + r = QRect(tab->rect.right() - w - hpadding, midHeight, w, h); r = visualRect(tab->direction, tab->rect, r); } if (verticalTabs) { if (atTheTop) - r = QRect(midWidth, tr.y() + tab->rect.height() - 6 - h, w, h); + r = QRect(midWidth, tr.y() + tab->rect.height() - hpadding - h, w, h); else - r = QRect(midWidth, tr.y() + 6, w, h); + r = QRect(midWidth, tr.y() + hpadding, w, h); } } |