[Kde-bindings] Qyoto: SIGNALS/SLOTS

Richard Dale Richard_Dale at tipitina.demon.co.uk
Thu Dec 29 13:26:45 UTC 2005

On Tuesday 27 December 2005 00:31, Arno Rehn wrote:
> Ok, another question:
> Today I tried to get return values working. I modified 'CallMethod' in
> qt3qyoto.cpp to get the return value of 'MethodCall.var()' in
> SmokeInvocation.cs. That worked and I can get the value of methods which
> return an 'int' (I haven't tested other types) via the StackItem-struct. I
> think it will also go well with 'long', 'byte', etc. But when the method
> returns a string I don't know what to do. How do I get a string out of
> 'StackItem' ?
> See attached files.
OK thanks for that - I've just checked in a change to implement return types, 
but have done it a bit differently to what you had. 

What should have been happening is that the MethodReturnCall class should have 
been modifying the zeroth entry of the array of SmokeItems passed to 
CallMethod(). Then you don't need to use MethodCall.var() to return it. 

A QString return value would be marshalled to a C# string, which would be in a 
GCHandle in the 's_class' field of the C# array of SmokeItems. Similary Qt 
instances like QWidget need to end up as GCHandles in the 's_class' field. 
Primitive types are held directly in 's_int' or whatever in the SmokeItem. 
The only difference between the C++ array of SmokeItems, and the one built up 
in C# in SmokeInvocation.cs, is that non-primitive types are held as 
GCHandles, rather than as C++ pointers.

-- Richard

More information about the Kde-bindings mailing list