[Kde-bindings] custom slots
Thomas Moenicke
tm at ippfp.org
Tue May 9 21:47:06 UTC 2006
Hi Richard,
Richard Dale wrote:
> First it calls the QObject::metaObject() method via the Smoke library on
> the parent class to get the parent QMetaObject ('superdata'). Then it
> unwraps the C data from the ruby arguments passed, and constructs the
> QMetaObject with this call:
>
> QMetaObject ob = {
> { superdata, stringdata, data, 0 }
> } ;
>
> QMetaObject * meta = new QMetaObject;
> *meta = ob;
It works fine. Nice to have tutorial 7 :-)
Is it possible to replace the staticMetaObject? I made a 'QMetaObject*
dynamicMetaObject' member of the class and could access it, but it lost its
values at runtime. It is wastage to rebuild the object in every call of
metaObject(). Otherwise, I can add new slots at runtime.
> If the id passed to qt_metacall is less than the start offset for the
> signals in the dynamically constructed QMetaObject for ruby slots, then it
> must be a C++. Otherwise, it drops through the 'id < offset' test and the
> code marshalls the C++ args in '_o' to ruby ones and calls the ruby method.
It is easy to implement it with the help of indexOfSlot(int),
indexOfSignals(int) methods, the array members of _a[] can be invoked into
zend types.
--
Thomas
More information about the Kde-bindings
mailing list