Don't keep static references to QPainter.
For some reason, this seems to cause a segfault.
This commit is contained in:
parent
76a459f604
commit
9257f0c98a
@ -45,7 +45,6 @@ class StatusBar(QWidget):
|
|||||||
moved = pyqtSignal('QPoint')
|
moved = pyqtSignal('QPoint')
|
||||||
_error = False
|
_error = False
|
||||||
_option = None
|
_option = None
|
||||||
_painter = None
|
|
||||||
_stylesheet = """
|
_stylesheet = """
|
||||||
QWidget#StatusBar[error="false"] {{
|
QWidget#StatusBar[error="false"] {{
|
||||||
{color[statusbar.bg]}
|
{color[statusbar.bg]}
|
||||||
@ -114,9 +113,9 @@ class StatusBar(QWidget):
|
|||||||
# pylint: disable=unused-argument
|
# pylint: disable=unused-argument
|
||||||
self._option = QStyleOption()
|
self._option = QStyleOption()
|
||||||
self._option.initFrom(self)
|
self._option.initFrom(self)
|
||||||
self._painter = QPainter(self)
|
painter = QPainter(self)
|
||||||
self.style().drawPrimitive(QStyle.PE_Widget, self._option,
|
self.style().drawPrimitive(QStyle.PE_Widget, self._option,
|
||||||
self._painter, self)
|
painter, self)
|
||||||
|
|
||||||
def disp_error(self, text):
|
def disp_error(self, text):
|
||||||
"""Displaysan error in the statusbar."""
|
"""Displaysan error in the statusbar."""
|
||||||
@ -351,7 +350,6 @@ class TextBase(QLabel):
|
|||||||
|
|
||||||
elidemode = None
|
elidemode = None
|
||||||
_elided_text = None
|
_elided_text = None
|
||||||
_painter = None
|
|
||||||
|
|
||||||
def __init__(self, bar, elidemode=Qt.ElideRight):
|
def __init__(self, bar, elidemode=Qt.ElideRight):
|
||||||
super().__init__(bar)
|
super().__init__(bar)
|
||||||
@ -382,8 +380,8 @@ class TextBase(QLabel):
|
|||||||
if self.elidemode == Qt.ElideNone:
|
if self.elidemode == Qt.ElideNone:
|
||||||
super().paintEvent(e)
|
super().paintEvent(e)
|
||||||
else:
|
else:
|
||||||
self._painter = QPainter(self)
|
painter = QPainter(self)
|
||||||
self._painter.drawText(0, 0, self.geometry().width(),
|
painter.drawText(0, 0, self.geometry().width(),
|
||||||
self.geometry().height(), self.alignment(),
|
self.geometry().height(), self.alignment(),
|
||||||
self._elided_text)
|
self._elided_text)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user