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

Sven Moritz Hallberg hallberg at pre-sense.de
Mon May 23 16:05:54 UTC 2011


On 05/20/2011 05:16 PM, Sven Moritz Hallberg wrote:
>> foo.prop = Qt::Variant.new(1.23)
>> puts foo.prop
> 
> so... in my view all variants would end up setting a member @prop to 123, "My
> String", or 1.23, respectively, right? the only case i don't support so far is
> the last, unwrapping a Qt::Variant if given.

er, actually, i do just that. i don't know what i was smoking when i wrote
otherwise...

> @klass.send(:define_method, writer) { |x|
>     x = x.value if x.is_a?(Qt::Variant)
>     instance_variable_set(propvar, x)
>     self.send(signame.to_sym, x)
>     x
> }

-- 
Sven Moritz Hallberg                      hallberg at pre-sense.de
                                  Tel. +49 - 40 - 244 2407 - 28
                                  Fax  +49 - 40 - 244 2407 - 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/20110523/d2977225/attachment.sig>


More information about the Kde-bindings mailing list