[PyQt] segfault on casting a QPaintDevice to a QWidget

Wilbert Berendsen wb at xs4all.nl
Sun Mar 15 22:13:38 GMT 2015


Friends,

I try this:

wilbert at sweelinck:~$ python  # (both 2 and 3)
Python 2.7.8 (default, Oct 20 2014, 15:05:29) 
[GCC 4.9.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt4.QtGui import *
>>> a = QApplication([])
>>> w = QWidget()
>>> import sip
>>> p = sip.cast(w, QPaintDevice)
>>> w1 = sip.cast(p, QWidget)
>>> dir(w1)
Segmentatiefout

This may look contrived, but I want to get the widget via the
painter.paintEngine().paintDevice() inside the paint() method of
QIconEngineV2, to adjust the icon based on what widget type it is
drawn on.

Best regards,
Wilbert


-- 
Wilbert Berendsen
(http://www.wilbertberendsen.nl)



More information about the PyQt mailing list