Improve performance with statusbar error property

This commit is contained in:
Florian Bruhin 2014-08-27 21:03:43 +02:00
parent af10d1c857
commit 3a73f9f532

View File

@ -190,6 +190,11 @@ class StatusBar(QWidget):
Re-set the stylesheet after setting the value, so everything gets
updated by Qt properly.
"""
if self._error == val:
# This gets called a lot (e.g. if the completion selection was
# changed), and setStyleSheet is relatively expensive, so we ignore
# this if there's nothing to change.
return
log.statusbar.debug("Setting error to {}".format(val))
self._error = val
self.setStyleSheet(style.get_stylesheet(self.STYLESHEET))