diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-08-27 12:50:13 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-08-27 14:54:19 (GMT) |
commit | 8dd8090f5f5c4bfddef87d9244a353f42ddf9db4 (patch) | |
tree | 93a66c1cc322d3c63118922d8a16a078c8614127 /src/gui/styles/qcommonstyle.cpp | |
parent | e534abc781cb5751736d24a1a5610370c243b519 (diff) | |
download | Qt-8dd8090f5f5c4bfddef87d9244a353f42ddf9db4.zip Qt-8dd8090f5f5c4bfddef87d9244a353f42ddf9db4.tar.gz Qt-8dd8090f5f5c4bfddef87d9244a353f42ddf9db4.tar.bz2 |
QTabBar: fix text being croped when there is an icon on the tab
By making sure the computation in QTabBar::tabSizeHint and
QCommonStylePrivate::tabLayout are the same
Reviewed-by: jbache
Diffstat (limited to 'src/gui/styles/qcommonstyle.cpp')
-rw-r--r-- | src/gui/styles/qcommonstyle.cpp | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index ccdce28..9dee6eb 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -1194,6 +1194,11 @@ void QCommonStylePrivate::tabLayout(const QStyleOptionTabV3 *opt, const QWidget tr.setLeft(tr.left() + 6 + 2 + (verticalTabs ? opt->leftButtonSize.height() : opt->leftButtonSize.width())); } + // right widget + if (!opt->rightButtonSize.isEmpty()) { + tr.setRight(tr.right() - 6 - 2 - + (verticalTabs ? opt->rightButtonSize.height() : opt->rightButtonSize.width())); + } // icon if (!opt->icon.isNull()) { @@ -1206,24 +1211,11 @@ void QCommonStylePrivate::tabLayout(const QStyleOptionTabV3 *opt, const QWidget (opt->state & QStyle::State_Enabled) ? QIcon::Normal : QIcon::Disabled, (opt->state & QStyle::State_Selected) ? QIcon::On : QIcon::Off ); - int left = opt->rect.left(); - int offset = 4; - if (opt->leftButtonSize.isEmpty()) - offset += 2; - else - left += opt->leftButtonSize.width() + (6 + 2) + 2; - - *iconRect = QRect(left + offset, tr.center().y() - tabIconSize.height() / 2, + *iconRect = QRect(tr.left(), tr.center().y() - tabIconSize.height() / 2, tabIconSize.width(), tabIconSize .height()); if (!verticalTabs) *iconRect = proxyStyle->visualRect(opt->direction, opt->rect, *iconRect); - tr.setLeft(tr.left() + tabIconSize.width() + offset + 2); - } - - // right widget - if (!opt->rightButtonSize.isEmpty()) { - tr.setRight(tr.right() - 6 - 2 - - (verticalTabs ? opt->rightButtonSize.height() : opt->rightButtonSize.width())); + tr.setLeft(tr.left() + tabIconSize.width() + 4); } if (!verticalTabs) |