diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-05-04 15:14:18 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-05-04 15:14:18 (GMT) |
commit | 154dbc010735d6c7aed89398757b1ad566ca67ea (patch) | |
tree | 028f4354aeaca7b0f5c354faebd91dcce62e646f /src/gui/widgets/qtabbar.cpp | |
parent | 3cd611df87645df05fcc747ebb5dcebff05132e4 (diff) | |
parent | 49a3c9840116fce1fb4c2f7cd2dcd4c85bd20032 (diff) | |
download | Qt-154dbc010735d6c7aed89398757b1ad566ca67ea.zip Qt-154dbc010735d6c7aed89398757b1ad566ca67ea.tar.gz Qt-154dbc010735d6c7aed89398757b1ad566ca67ea.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2:
Skip failing auto-test on Mac and Linux QWS
Update changelog after last change.
QTabBar: smaller minimumSizeHint in ElideMode, and unit-test.
Fix tab stop in QPainter::drawText()
Diffstat (limited to 'src/gui/widgets/qtabbar.cpp')
-rw-r--r-- | src/gui/widgets/qtabbar.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/gui/widgets/qtabbar.cpp b/src/gui/widgets/qtabbar.cpp index 8aaaade..54d443a 100644 --- a/src/gui/widgets/qtabbar.cpp +++ b/src/gui/widgets/qtabbar.cpp @@ -1247,6 +1247,8 @@ QSize QTabBar::sizeHint() const QSize QTabBar::minimumSizeHint() const { Q_D(const QTabBar); + if (d->layoutDirty) + const_cast<QTabBarPrivate*>(d)->layoutTabs(); if (!d->useScrollButtons) { QRect r; for (int i = 0; i < d->tabList.count(); ++i) @@ -1259,22 +1261,23 @@ QSize QTabBar::minimumSizeHint() const return QSize(d->rightB->sizeHint().width() * 2 + 75, sizeHint().height()); } +// Compute the most-elided possible text, for minimumSizeHint static QString computeElidedText(Qt::TextElideMode mode, const QString &text) { - if (text.length() <= 7) + if (text.length() <= 3) return text; static const QLatin1String Ellipses("..."); QString ret; switch (mode) { case Qt::ElideRight: - ret = text.left(4) + Ellipses; + ret = text.left(2) + Ellipses; break; case Qt::ElideMiddle: - ret = text.left(2) + Ellipses + text.right(2); + ret = text.left(1) + Ellipses + text.right(1); break; case Qt::ElideLeft: - ret = Ellipses + text.right(4); + ret = Ellipses + text.right(2); break; case Qt::ElideNone: ret = text; @@ -1921,7 +1924,7 @@ void QTabBar::keyPressEvent(QKeyEvent *event) event->ignore(); return; } - int offset = event->key() == (isRightToLeft() ? Qt::Key_Right : Qt::Key_Left) ? -1 : 1; + int offset = event->key() == (isRightToLeft() ? Qt::Key_Right : Qt::Key_Left) ? -1 : 1; d->setCurrentNextEnabledIndex(offset); } |