Handle ampersands in tab titles correctly.

Fixes #301.
This commit is contained in:
Florian Bruhin 2014-12-03 17:44:15 +01:00
parent 95d919b5f6
commit 1af7112ea4
2 changed files with 3 additions and 4 deletions

View File

@ -459,7 +459,7 @@ class TabbedBrowser(tabwidget.TabWidget):
# We can get signals for tabs we already deleted...
log.webview.debug("Got invalid tab {}!".format(tab))
return
self.setTabText(idx, text)
self.setTabText(idx, text.replace('&', '&&'))
if idx == self.currentIndex():
self._change_app_title(text)

View File

@ -343,9 +343,8 @@ class TabBarStyle(QCommonStyle):
else QIcon.Off)
icon = opt.icon.pixmap(opt.iconSize, icon_mode, icon_state)
p.drawPixmap(icon_rect.x(), icon_rect.y(), icon)
self._style.drawItemText(p, text_rect,
Qt.AlignLeft | Qt.AlignVCenter,
opt.palette,
alignment = Qt.AlignLeft | Qt.AlignVCenter | Qt.TextHideMnemonic
self._style.drawItemText(p, text_rect, alignment, opt.palette,
opt.state & QStyle.State_Enabled,
opt.text, QPalette.WindowText)
else: