[Kde-bindings] Hacking moc-generated code

Marcus mathpup at mylinuxisp.com
Wed Aug 31 05:08:39 UTC 2005


I would like to hear more about this because getting signals and slots working 
seems to be one of the hardest parts. I understand that Qt 4.x makes some 
changes, but I also gather that there is still a great deal of voodoo in the 
moc-generated code. 

When I have worked on schemes to interact with signals and slots, I have 
always been torn between using things are not part of the Qt API whose 
details can only be discovered by reading the files that moc generates OR 
writing portable but complicated, bulky code with a great deal of potential 
overhead. Qt goes to great lengths to make C++ less dangerous for 
programmers, but many of the techniques used make it difficult for non-C++ 
languages to use Qt.



On Tuesday 30 August 2005 10:47 pm, Eric Jardim wrote:
> Hi,
>
> I am doing Python bindings for the Qt4 library (with Boost.Python), and I
> would like to know/share what do you know about the moc generated code.
>
> Indeed, as you may know, this code does the "tricks" necessary to make
> signals/slots work. I am looking for docs or experiences with the moc
> (specially with the Qt4) generated code, to be able to put Python extended
> Widgets inside QtDesigner, and later embedded on C++.
>
> All, I know that everything points to this "qt_metacall(QMetaObject::Call
> _c, int _id, void **_a)" function, but it is a little hard to understand
> the code. I tried googling to find the specs or something but I just this:
> http://jahqueel.blogspot.com/2005/06/smoke-for-kde4.html
> http://www.kdedevelopers.org/node/1149
>
> I also searched the Qt docs, but it is very superficial (that's ok for
> regular Qt users). So, I have to do the moc job, and create this
> qt_metacall, method and point it to the right Python funtions.
>
> BTW, here are the Python bindings. There are working examples on it:
> http://developer.berlios.de/projects/python-qt4/
> Try the downloadable version (not the SVN), please, and have fun :)




More information about the Kde-bindings mailing list