[PyQt] QTextLayout.createLine crashes

Jérôme Laheurte jerome at jeromelaheurte.net
Mon Mar 27 10:11:55 BST 2017


Hello. This smells like a bug; I was « porting » the ElidedLabel sample when I stumbled upon it. The following code crashes with a SIGSEGV in createLine() (Qt/PyQt 5.8.1, mac OS 10.11.6):


from PyQt5 import QtWidgets, QtGui


class TestWidget(QtWidgets.QWidget):
    def paintEvent(self, event):
        painter = QtGui.QPainter(self)
        layout = QtGui.QTextLayout('spam', painter.font())
        line = layout.createLine()


app = QtWidgets.QApplication([])
win = TestWidget()
win.show()
win.raise_()
app.exec_()

I tried keeping a reference on the string and the font (and creating my own font), same result every time. Any idea ?

Best regards
Jérôme Laheurte

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 842 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20170327/87169438/attachment.sig>


More information about the PyQt mailing list