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/widgets | |
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/widgets')
-rw-r--r-- | src/gui/widgets/qtabbar.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/gui/widgets/qtabbar.cpp b/src/gui/widgets/qtabbar.cpp index d8246c8..f3775c2 100644 --- a/src/gui/widgets/qtabbar.cpp +++ b/src/gui/widgets/qtabbar.cpp @@ -1293,6 +1293,7 @@ QSize QTabBarPrivate::minimumTabSizeHint(int index) */ QSize QTabBar::tabSizeHint(int index) const { + //Note: this must match with the computations in QCommonStylePrivate::tabLayout Q_D(const QTabBar); if (const QTabBarPrivate::Tab *tab = d->at(index)) { QStyleOptionTabV3 opt; @@ -1309,18 +1310,18 @@ QSize QTabBar::tabSizeHint(int index) const int widgetWidth = 0; int widgetHeight = 0; int padding = 0; - if (opt.leftButtonSize.isValid()) { + if (!opt.leftButtonSize.isEmpty()) { padding += 6 + 2; widgetWidth += opt.leftButtonSize.width(); widgetHeight += opt.leftButtonSize.height(); } - if (opt.rightButtonSize.isValid()) { + if (!opt.rightButtonSize.isEmpty()) { padding += 6 + 2; widgetWidth += opt.rightButtonSize.width(); widgetHeight += opt.rightButtonSize.height(); } - if (opt.iconSize.isValid()) - padding += 2; + if (!opt.icon.isNull()) + padding += 4; QSize csz; if (verticalTabs(d->shape)) { |