[Kde-bindings] Re: Custom properties on QObjects defined in qtruby

Sven Moritz Hallberg hallberg at pre-sense.de
Tue Apr 12 14:10:09 UTC 2011


On 04/07/2011 09:16 PM, Sven Moritz Hallberg wrote:
> As far as I can tell, I need to catch a
> 
>     qt_metacall(ReadProperty, ...)
> 
> somewhere and let it dispatch to the given READ function. Is that right? I
> just can't see where or how.

OK, I've added the following to qt_metacall in src/qtruby.cpp:

    if (_c == QMetaObject::ReadProperty) {
        argv[2] = rb_funcall(self, rb_intern("qt_readprop"), 2, argv[1]);
        return INT2NUM(-1);
    }

The function qt_readprop I defined in class Base and it just finds and calls
the READ function for the requested property. That works. My function is
called every time something tries to read the property and it returns the
value to C++. What I can't figure out is how to communicate that result back
to Qt land... As you can see, I've tried simply assigning to argv[2] above,
but that seems to have no effect. Is there some kind of marshalling magic I
need to invoke? Maybe someone has a tip here...

Thanks!

-- 
Sven Moritz Hallberg                      hallberg at pre-sense.de
                                   Tel. +49 - 40 / 244 24 07-28
                                   Fax  +49 - 40 / 244 24 07-24
PRESENSE Technologies GmbH            Sachsenstr. 5, D-20097 HH
                                         USt-IdNr.: DE263765024
Geschäftsführer/Managing Directors       AG Hamburg, HRB 107844
Till Dörges           Jürgen Sander              Axel Theilmann

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://mail.kde.org/pipermail/kde-bindings/attachments/20110412/71571d45/attachment.sig>


More information about the Kde-bindings mailing list