Details
-
Bug
-
Resolution: Duplicate
-
Not Evaluated
-
None
-
6.6.1
-
None
Description
The following code seems to work perfectly well in PySide version 6.3.2. However in PySide 6.6.1 this code will lead to a 'Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)'.
from PySide6.QtCore import QSize, Qt, Property from PySide6.QtWidgets import QWidget, QGridLayout, QTextEdit, QApplication, QSizePolicy class Line(QWidget): _polishRecursionGuard = False _thickness = 0 _orientation = Qt.Orientation(0) def __init__(self, orientation=Qt.Orientation.Horizontal, thickness=1, parent=None, **kwargs): super().__init__(parent, **kwargs) self.orientation = orientation self.thickness = thickness self.setAttribute(Qt.WA_StyledBackground, True) @Property(Qt.Orientation) def orientation(self): return self._orientation @orientation.setter def orientation(self, orientation): if self._orientation != orientation: self._orientation = orientation if orientation == Qt.Orientation.Horizontal: self.setSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Fixed) else: self.setSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Preferred) self.updateGeometry() self._polish() @Property(int) def thickness(self): return self._thickness @thickness.setter def thickness(self, size): if size < 1: return if self._thickness != size: self._thickness = size self.updateGeometry() self._polish() def _polish(self): if not self._polishRecursionGuard: self._polishRecursionGuard = True self.style().unpolish(self) self.style().polish(self) self._polishRecursionGuard = False def minimumSizeHint(self): return self.sizeHint() def sizeHint(self): if self._orientation == Qt.Orientation.Horizontal: return QSize(1, self._thickness) return QSize(self._thickness, 1) app = QApplication([]) app.setStyleSheet(''' Line[orientation=Horizontal] { background: orange; qproperty-thickness: 4; } Line[orientation=Vertical] { background: green; qproperty-thickness: 12; } Line#topSeparator { qproperty-orientation: Vertical; } ''') test = QWidget() l = QGridLayout(test) l.addWidget(QTextEdit()) l.addWidget(Line(objectName='topSeparator'), 0, 1) l.addWidget(QTextEdit(), 0, 2) l.addWidget(Line(objectName='midSeparator'), 1, 0, 1, 3) l.addWidget(QTextEdit(), 2, 0, 1, 3) test.show() app.exec()
Having tried to debug the situation, the crash seems to be related in some way to the fact that Qt.Orientation was used as a property.
As to provide some further information, my current setup uses python 3.10. Additionally, out of curiosity, I have tested whether this code runs in PyQt 6.6.1 as opposed to PySide 6.6.1 and there it seems to run without issue.
Attachments
Issue Links
- duplicates
-
QTBUG-121790 QApplication::setStyleSheet crashes QTextEdit
-
- Closed
-