[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] segfault on casting a QPaintDevice to a QWidget
From:       Phil Thompson <phil () riverbankcomputing ! com>
Date:       2015-03-16 17:32:39
Message-ID: b2c47c53c22cad1d75971b4731d6e441 () riverbankcomputing ! com
[Download RAW message or body]

On 15/03/2015 10:13 pm, Wilbert Berendsen wrote:
> Friends,
> 
> I try this:
> 
> wilbert@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

...because casting to a more specific type with multiple inheritance has 
problems.

> 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.

If Python knows about the widget then paintDevice() should return it 
with type QWidget.

Phil
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic