[Kde-bindings] qtruby: problem communicating ruby-defined objects via properties

Sven Moritz Hallberg hallberg at pre-sense.de
Fri May 27 17:50:13 UTC 2011


hi all,

here's a problem i'm experiencing with my qtruby property patch posted before.
hopefully someone can shed some light on what's to blame here.

in the attached program, i define and instantiate two custom descendants of
Qt::Object. one contains the other in a property. the QML side tries to
extract the value of the property and call a slot on the object. unfortunately
it never gets that far because the value it gets from the property is not
translated to a Javascript object.

for comparison it exports the object directly first.

expected output:
[qml] bar = Bar(0x...)
[qml] calling bar.baz(123)
[ruby] in baz: got 123.0
[qml] foo.bar = Bar(0x...)
[qml] calling foo.bar.baz(123)
[ruby] in baz: got 123.0

actual output:
[qml] bar = Bar(0x206ec10)
[qml] calling bar.baz(123)
[ruby] in baz: got 123.0
[qml] foo.bar = QVariant(rObject)
[qml] calling foo.bar.baz(123)
file:///home/hallberg/test/qt2a.qml:13: TypeError: Result of expression
'foo.bar.baz' [undefined] is not a function.

note foo.bar being printed as QVariant(rObject) instead of Bar.

any help?

TIA!
Sven

-- 
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: qt2a.rb
Type: application/x-ruby
Size: 695 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-bindings/attachments/20110527/a2ffc931/attachment.bin>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: qt2a.qml
URL: <http://mail.kde.org/pipermail/kde-bindings/attachments/20110527/a2ffc931/attachment.ksh>
-------------- 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/20110527/a2ffc931/attachment.sig>


More information about the Kde-bindings mailing list