Jim Bublitz <[EMAIL PROTECTED]> wrote: >> But I wonder why the following does not work: >> ptr = sip.unwrapinstance(qt.qApp.mainWidget()) >> mainWindow = sip.wrapinstance(ptr, qt.QMainWindow) >> Unfortunately mainWindow is still a QWidget. > > I'm not sure - my guess is that it's because ptr is already typed in > Python as a QWidget. I've done something similar to get a C++ object > into Python, but the object was already the correct type - just > instantiating the wrapper, but no cast involved. > > You might try: > > mainWindow = sip.cast (ptr, qt.QMainWindow)
We just discussed this on the list. Phil is going to implement a general solution so that you always get the most derived class Python knows about -- QMainWindow in this case. Giovanni Bajo _______________________________________________ PyKDE mailing list [email protected] http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
