Fix Qt Mnemonics affecting min tab width

See #3245
This commit is contained in:
Jay Kamat 2017-11-06 14:35:50 -05:00
parent b1f1248a05
commit ecf6f4bca0
No known key found for this signature in database
GPG Key ID: 5D2E399600F4F7B5

View File

@ -501,8 +501,12 @@ class TabBar(QTabBar):
""" """
text = '\u2026' if ellipsis else tab_text text = '\u2026' if ellipsis else tab_text
# Don't ever shorten if text is shorter than the ellipsis # Don't ever shorten if text is shorter than the ellipsis
text_width = min(self.fontMetrics().width(text),
self.fontMetrics().width(tab_text)) def _text_to_width(text):
# Calculate text width taking into account qt mnemonics
return self.fontMetrics().size(Qt.TextShowMnemonic, text).width()
text_width = min(_text_to_width(text),
_text_to_width(tab_text))
padding = config.val.tabs.padding padding = config.val.tabs.padding
indicator_width = config.val.tabs.width.indicator indicator_width = config.val.tabs.width.indicator
indicator_padding = config.val.tabs.indicator_padding indicator_padding = config.val.tabs.indicator_padding