[Kde-bindings] QtRuby - Ruby objects as signal arguments
Richard Dale
rdale at foton.es
Fri Sep 1 16:31:42 UTC 2006
On Friday 01 September 2006 15:13, Marek Janukowicz wrote:
> On Friday 01 September 2006 15:45, Richard Dale wrote:
> > > Is it possible to use Ruby objects (my own custom class) as signal
> > > arguments and - if so - how should be signal declaration look like?
> >
> > Only if they are a subclass of a class in the Smoke library, and then you
> > must use the type of the base class in the signal argument, not the
> > actual ruby class.
>
> So may I "fool" QtRuby by creating a subclass of, say, Qt::Object, passing
> such an object as signal argument and then - in the slot - using it as my
> subclass? Do I have to provide some means to marshall this object?
No, it will work because QtRuby keeps track of the relationship between the
C++ instance and the corresponding ruby instance (and vica versa). So even if
you emit MyRubyClass as an argument to a signal defined as 'const QObject&'
argument type of the signal, it will still be a MyRubyClass instance when it
gets passed as an argument to the Ruby slot.
-- Richard
More information about the Kde-bindings
mailing list