2005/9/9, Richard Dale <<a href="mailto:Richard_Dale@tipitina.demon.co.uk">Richard_Dale@tipitina.demon.co.uk</a>>:<br>
<blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">I wrote a blog about the format of the Qt4 QMetaObjects here:<br>
  <span class="q"><a onclick="return top.js.OpenExtLink(window,event,this)" href="http://www.kdedevelopers.org/node/1149" target="_blank">http://www.kdedevelopers.org/node/1149</a></span><br>
  <span class="q"></span></blockquote>
<span class="q"><br>
And I read it. It helped a lot ;)<br>
<br>
<br>
</span><div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">You can override QObject::metaObject() as it's a virtual method, and then
<br>construct a QMetaObject dynamically and return that instead of the usual<br>statically allocated one. </blockquote><div><br>
Sure, after hours examining moc generated code, I understood some of the way how it worked. <br>
<br>
</div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> It just comes down to constructing a string table full of<br>null terminated strings, and a corresponding array of numeric pointers that
<br>give the offsets of the strings. </blockquote><div><br>
This is quite straightforward. The problem was if Qt cached the
QMetaObjects. If it did it, our work would be completely lost. But it
queries it all the time, and that is the right approach. Objects are
subject to change their structure dynamically.<br>
<br>
Qt/C++ moc generated objects have static(local shared) and
static(immutable) QMetaObject. Now, we need "not shared" and "mutable"
QMetaObjects. Say, we can change the metaobject of a class, or even a
single instance. In Python this is completely normal. <br>
<br>
This means that I can, in Python, create, change or delete signal and
slots dynamically (bye, bye moc)! The next step would be classinfo,
properties and interfaces.<br>
</div><br>
<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">A slot is invoked via QObject::qt_metacall() which is also a virtual method<br>that you can override. You need to marshall the arguments from C++ format
<br>your scripting language from an array of 'void *'s that qt_metacall()<br>expects.</blockquote><div><br>
Yeah!  I have managed this. And it is a very interesting approach. <br>
<br>
</div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">To emit a signal you need to call QObject->metaObject()->activate() with your
<br>scripting languages args converted to C++ ones in the same  'void*' array for<br>qt_metacall().<br></blockquote></div><br>
I sugest you reading what I did in python-qt4:<br>
<a href="http://svn.berlios.de/viewcvs/python-qt4/trunk/PythonQt/PythonQObject.h?view=markup">http://svn.berlios.de/viewcvs/python-qt4/trunk/PythonQt/PythonQObject.h?view=markup</a><br>
<br>
I also managed to put a Python plugin in QtDesigner. <br>
<br>
Things are getting very interesting ;)<br>
<br>
[Eric Jardim]<br>