[PyQt] Segfault when creating adding text to a QPainterPath

Ricard Marxer rmarxer at iua.upf.edu
Wed Jul 11 19:31:39 BST 2007


On Wednesday 11 July 2007 18:18:17 Ricard Marxer wrote:
> Hi list,
>
> Could you help me out here?  Am I doing something wrong?
>
> Python 2.5.1 (r251:54863, May  2 2007, 16:56:35)
> [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>
> >>> from PyQt4.QtCore import *
> >>> from PyQt4.QtGui import *
> >>> qVersion()
>
> '4.2.3'
>
> >>> p = QPainterPath()
> >>> p.addText(QPointF(0,0),QFont('Times',10),QString('a'))
>
> Segmentation fault (core dumped)
>
> Thanks
> ricard
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Ok, I've got it. It looks like it's necessary to create a QApplication 
beforehand.  I still think it's weird that it Segfaults.

This works (well, at least it doesn't crash):
Python 2.5.1 (r251:54863, May  2 2007, 16:56:35)
[GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt4.QtCore import *
>>> from PyQt4.QtGui import *
>>> qVersion()
'4.2.3'
>>> app=QApplication([])
>>> p=QPainterPath()
>>> p.addText(QPointF(0,0),QFont('Times',10),'a')
>>> 

Is this a PyQt bug? a Qt bug? or most probably my bug?


More information about the PyQt mailing list