Details
-
Bug
-
Resolution: Incomplete
-
Not Evaluated
-
None
-
4.8.2
-
None
-
Windows 7
Description
If I subclass QTabBar and set elideMode to something other than ElideNone, the widget has the potential to display scroll buttons when they are not needed.
See the attached image and project.
This seems to boil down to a change where eliding was made more aggressive in QTabBar: http://qt.gitorious.org/qt/qt/merge_requests/583
For a short tab name, like "Main" (which is narrower than "M...n"), minimumTabSizeHint() will return an incorrect value.
I have fixed this locally by changing that method to this:
QSize QTabBarPrivate::minimumTabSizeHint(int index) { Q_Q(QTabBar); // ### Qt 5: make this a protected virtual function in QTabBar Tab &tab = tabList[index]; const QFontMetrics fm = q->fontMetrics(); QString oldText = tab.text; QString elidedText = computeElidedText(elideMode, oldText); if(fm.size(Qt::TextShowMnemonic, elidedText).width() < fm.size(Qt::TextShowMnemonic, oldText).width()) { tab.text = elidedText; QSize elidedSize = q->tabSizeHint(index); tab.text = oldText; return elidedSize; } return q->tabSizeHint(index); }