[Kde-bindings] Qyoto: SIGNALS/SLOTS
Arno Rehn
arno at arnorehn.de
Fri Dec 30 13:36:53 UTC 2005
Am Freitag, 30. Dezember 2005 12:12 schrieb Richard Dale:
> On Friday 30 December 2005 11:05, Richard Dale wrote:
> > On Thursday 29 December 2005 23:19, Arno Rehn wrote:
> > > > 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 ?
> >
> > Have a look at the code the marshall_basetype() function in
> > qt3handlers.cpp:
> >
> > smokeqyoto_object *o = value_obj_info(m->var().s_class);
> >
> > value_obj_info() in qt3qyoto.cpp obtains the smokeqyoto_object for the C#
> > instance with a callback, and then the C++ instance is 'o->ptr'.
> >
> > smokeqyoto_object *value_obj_info(void * qyoto_value) {
> > smokeqyoto_object * o = (smokeqyoto_object*) (*GetSmokeObject)
> > (qyoto_value);
> > return o;
> > }
>
> Actually I've described getting a C++ QWidget from a C# one, not how to get
> a QString from a C# string. See marshall_QString() for where that's done.
>
Yeah, found out about this last night ;)
--
MfG
Arno Rehn
arno at arnorehn.de
More information about the Kde-bindings
mailing list