[Kde-bindings] Qyoto: SIGNALS/SLOTS

Arno Rehn kde-bindings at arnorehn.de
Thu Dec 29 23:19:15 UTC 2005


Am Donnerstag, 29. Dezember 2005 14:26 schrieb Richard Dale:
> 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.

By the way, how do we get the other types like a string out of the struct in 
C++, when we call a method in C# like 'SetText' ? The GCHandle of the string 
is stored in s_intptr in the C#-struct, but there is no equivalent for this 
in the C++-struct. How can we access it in C++ then ?

-- 
Arno Rehn
arno at arnorehn.de



More information about the Kde-bindings mailing list