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

Richard Dale richard.dale at telefonica.net
Wed Jun 1 18:34:52 UTC 2011


On Wednesday, June 01, 2011 07:14:07 PM Arno Rehn wrote:
> On Wednesday 01 June 2011 20:06:55 Richard Dale wrote:
> > On Wednesday, June 01, 2011 06:26:37 PM Sven Moritz Hallberg wrote:
> > > On 06/01/2011 04:55 PM, Sven Moritz Hallberg wrote:
> > > > On 05/31/2011 10:21 PM, Richard Dale wrote:
> > > >>> note foo.bar being printed as QVariant(rObject) instead of Bar.
> > > >> 
> > > >> I think it needs to be exposed as a QObject or maybe a QObject
> > > >> wrapped inside a QVariant. The QML runtime doesn't know anything
> > > >> about about rObjects.
> > > > 
> > > > that's what i figure, too. afaict it should be a QVariant containing
> > > > *some* other type than rObject. alas, i'm stumped on what exactly. do
> > > > we need to register a type? or is it enough to use something generic?
> > > > (QMetaType::QObjectStar maybe?!) and then, how to actually create
> > > > this QVariant object? i can't see through the forest of
> > > > constructors.
> > > 
> > > solved it! see attached...
> > 
> > Yes you're right, qvariant_from_value() is wrong. But about a year ago
> > the rObject functionality was added, and a lot of other stuff was
> > removed. I don't know why that was done and what was trying to be
> > achieved. Using 'git blame' it was Arno Rehn that made the change, but
> > it might have been from a patch that someone submitted.
> 
> Yes, this was a fix for a bug about not being able to use arbitrary ruby
> objects in Qt::Variant. I tested nearly everything to make sure nothing
> breaks, but maybe QObjects slipped through, or some later commit broke it
> again.
OK, I think if all else fails then the QVariant should wrap a rObject, but in 
my patch I haven't worked out how to do that yet. 

But I think the code to wrap all the other types is still needed -  we don't 
have any tests to run for qtruby to test for regressions. Maybe I'll try and 
add some tests for qtruby 3.x as I write it for this sort of thing.

-- Richard



More information about the Kde-bindings mailing list