-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thursday 18 April 2002 05:53 am, Phil Thompson wrote: > ian reinhart geiser wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > > Hash: SHA1 > > > > Okay I narrowed this down finally. It looks like the > > sipConvertToSubClassCode that is there crushes any objects created from a > > C++ based factory. Since it only knows about PyQt objects any derived > > ones fail. > > > > The issue is that when you pass a pointer from C++ to an embedded Python > > object it is cast to a QObject if the object has the misfortune of being > > derived from a QObject. The only other fix is to use MI to confuse SIP > > enough to leave it alone. It looks like with that code in place all > > objects created by a factory class get clobbered. I think we should > > revert the fix, because the old way at least worked. I commented out the > > sipConvertToSubClassCode sections and now it behaves like it should. > > > > Phil what are the chances this could get into 3.2 yet? > > Hang on. The old way was changed for you because it didn't do what you > wanted. The new way requires you to define %ConvertToSubClassCode for > your new classes in your module. Your code will be called before the > corresponding QObject code so that it can recognize your classes. I was afraid of that, I was looking through the cvs commit logs and my old emails with you and Catalin. It seems that it only effects QObjects so it never was a problem with korelibs. It seems to mangle all of the classes based off of QObjects back to QObjects. If you look at the SIP generated code the arg types are all QObjects and not the correct types. Catalin and I found this out last night, when we where testing some other embedding tests.
I think I see what you are trying to do though, the problem that you are having was present in early versions of DCOP. I have to look more at the function, but I think a big problem is the current map has no idea about inheritance. IE if I pass in a pointer from my QMainWindow based main window it will not cast to a QWidget, instead it converts to a QObject. Since this is correct in the eyes of C++ it compiles, but python screams bloody murder because it cannot do widget operations on a QObject. (I put "print parent" in the first line of every arg that had data passed in so I know they all converted to QObjects). > > As PyQt doesn't use this feature itself, it will not be fully tested - > that's up to you. Bland statements that something doesn't work and > therefore should be reverted are not helpful. A proper bug report would > be. Okay, well I tested it, and basicly it does as I said above, it converts all QObject based pointers back to QObjects so the types are all wrong in Python. I would remove the QObject conversion code for now, but drop the sipConvertToSubClassCode. I think I have an idea of how to make it flow more with hiarchy but it will require manual modification to every class that sip touches. Ideally sip should generate some sort of function table that is aware of the inheritance flow. I have to research this more though. For now the only place that needed this code is korelibs, and that is not based off of QObjects, so it dosent benefit from this anyway. I am trying to put together a korelibs example for PyQt so this can be tested for releases. I understand how irritating it is to have to deal with us because we are doing such strange things that really push siplib and pyqt to the limits of what they can do. I have to commend you for fixing the build system bug and threading bugs though. We now have Korelibs loading python based modules as native plugins. Basicly what this means is people can now embed python extentions into C++ without using sip on every module, only their base class. Also there is an untested ability to load C++ modules directly into python without any sip bindings what so ever. This is all exciting stuff. Thanks - -ian reinhart geiser -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE8vqgYPy62TRm8dvgRAizzAJ9IP3Y0Zz0nyml/NGYotpOnmvVSEQCaAwFi 7AjoszENu5XRRobE6YLxGGo= =qi+U -----END PGP SIGNATURE----- _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com _______________________________________________ PyKDE mailing list [EMAIL PROTECTED] http://mats.gmd.de/mailman/listinfo/pykde
