Set WA_StyledBackground for statusbar instead of overriding paintEvent
This commit is contained in:
parent
911d5d3b4a
commit
2fe2ca85c2
@ -21,8 +21,7 @@ import logging
|
|||||||
|
|
||||||
from PyQt5.QtCore import pyqtSignal, pyqtSlot, pyqtProperty, Qt
|
from PyQt5.QtCore import pyqtSignal, pyqtSlot, pyqtProperty, Qt
|
||||||
from PyQt5.QtWidgets import (QWidget, QLineEdit, QProgressBar, QLabel,
|
from PyQt5.QtWidgets import (QWidget, QLineEdit, QProgressBar, QLabel,
|
||||||
QHBoxLayout, QSizePolicy, QShortcut, QStyle,
|
QHBoxLayout, QSizePolicy, QShortcut)
|
||||||
QStyleOption)
|
|
||||||
from PyQt5.QtGui import QPainter, QKeySequence, QValidator
|
from PyQt5.QtGui import QPainter, QKeySequence, QValidator
|
||||||
|
|
||||||
import qutebrowser.utils.config as config
|
import qutebrowser.utils.config as config
|
||||||
@ -76,6 +75,7 @@ class StatusBar(QWidget):
|
|||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
self.setObjectName(self.__class__.__name__)
|
self.setObjectName(self.__class__.__name__)
|
||||||
|
self.setAttribute(Qt.WA_StyledBackground)
|
||||||
self.setStyleSheet(config.get_stylesheet(self._STYLESHEET))
|
self.setStyleSheet(config.get_stylesheet(self._STYLESHEET))
|
||||||
|
|
||||||
self.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Fixed)
|
self.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Fixed)
|
||||||
@ -123,14 +123,6 @@ class StatusBar(QWidget):
|
|||||||
self._error = val
|
self._error = val
|
||||||
self.setStyleSheet(config.get_stylesheet(self._STYLESHEET))
|
self.setStyleSheet(config.get_stylesheet(self._STYLESHEET))
|
||||||
|
|
||||||
def paintEvent(self, e):
|
|
||||||
"""Override QWIidget.paintEvent to handle stylesheets."""
|
|
||||||
# pylint: disable=unused-argument
|
|
||||||
option = QStyleOption()
|
|
||||||
option.initFrom(self)
|
|
||||||
painter = QPainter(self)
|
|
||||||
self.style().drawPrimitive(QStyle.PE_Widget, option, painter, self)
|
|
||||||
|
|
||||||
@pyqtSlot(str)
|
@pyqtSlot(str)
|
||||||
def disp_error(self, text):
|
def disp_error(self, text):
|
||||||
"""Display an error in the statusbar."""
|
"""Display an error in the statusbar."""
|
||||||
|
Loading…
Reference in New Issue
Block a user