Add workaround to keystring so it gets cleared properly.

This commit is contained in:
Florian Bruhin 2014-02-19 21:45:30 +01:00
parent 1c921a77f6
commit 561a7e1cdd
2 changed files with 10 additions and 3 deletions

2
TODO
View File

@ -5,8 +5,6 @@ All kind of FIXMEs
Weird font rendering
https://bugreports.qt-project.org/browse/QTBUG-20973
https://bugreports.qt-project.org/browse/QTBUG-21036
URL in statsbar sometimes doesn't draw correctly (when new URL longer?)
keystring sometimes doesn't fully clear in statusbar
Major features
==============

View File

@ -494,7 +494,14 @@ class TextBase(QLabel):
self.text(), self._elidemode, width, Qt.TextShowMnemonic)
def setText(self, txt):
"""Extend QLabel::setText to update the elided text afterwards.
"""Extend QLabel::setText.
This update the elided text after setting the text, and also works
around a weird QLabel redrawing bug where it doesn't redraw correctly
when the text is empty -- we explicitely need to call repaint() to
resolve this. See http://stackoverflow.com/q/21890462/2085149
FIXME is there a nicer way to work around this?
Args:
txt: The text to set (string).
@ -502,6 +509,8 @@ class TextBase(QLabel):
"""
super().setText(txt)
self._update_elided_text(self.geometry().width())
if not txt:
self.repaint()
def resizeEvent(self, e):
"""Extend QLabel::resizeEvent to update the elided text afterwards."""