Keep progress bar height fix on multiline text.

See #364 and #63.
This commit is contained in:
Florian Bruhin 2015-04-06 14:27:41 +02:00
parent 2876ba5cfa
commit 46d1760798

View File

@ -19,7 +19,7 @@
"""The progress bar in the statusbar."""
from PyQt5.QtCore import pyqtSlot
from PyQt5.QtCore import pyqtSlot, QSize
from PyQt5.QtWidgets import QProgressBar, QSizePolicy
from qutebrowser.browser import webview
@ -50,7 +50,7 @@ class Progress(QProgressBar):
def __init__(self, parent=None):
super().__init__(parent)
style.set_register_stylesheet(self)
self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Ignored)
self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
self.setTextVisible(False)
self.hide()
@ -75,3 +75,9 @@ class Progress(QProgressBar):
self.show()
else:
self.hide()
def sizeHint(self):
"""Set the height to the text height plus some padding."""
width = super().sizeHint().width()
height = self.fontMetrics().height() + 3
return QSize(width, height)