[Kde-bindings] Qyoto: SIGNALS/SLOTS

Arno Rehn kde-bindings at arnorehn.de
Tue Dec 27 00:31:15 UTC 2005


Am Samstag, 24. Dezember 2005 19:05 schrieb Arno Rehn:
> Am Freitag, 23. Dezember 2005 23:33 schrieb Arno Rehn:
> > Am Montag, 19. Dezember 2005 17:21 schrieb Adam Treat:
> > > On Monday December 19 2005 7:02 am, Richard Dale wrote:
> > > > In Qyoto the '_smokeObject' is a pointer directly to the C++
> > > > instance, it is a struct which contains that pointer, along with
> > > > several other things. So it is the direct equivalent of the Qt#
> > > > QtSharp class.
> > > >
> > > > From qyoto.h:
> > > >
> > > > struct smokeqyoto_object {
> > > >     bool allocated;
> > > >     Smoke *smoke;
> > > >     int classId;
> > > >     void *ptr;
> > > > };
> > > >
> > > > The 'ptr' field is the C++ instance. 'allocated' is true if the C#
> > > > instance was allocated from the C# side, or false if an existing C++
> > > > instance was wrapped, and the C++ instance shouldn't be deleted on
> > > > garbage collection. 'classId' is a numeric identifier that is used in
> > > > the lookup tables inside the Smoke library. 'smoke' is a  handle to
> > > > the Smoke library instance being used for the class (always the same
> > > > for every class in the current implementation).
> > >
> > > Ahh, that is cool.  I had something similar for libqtsharp.  So, Arno,
> > > it looks like the problem you were having was you were trying to
> > > connect the smoke object directly, instead of the underlying QObject
> > > which is the void ptr.  However, I think Richard is absolutely right,
> > > you don't want to be using Qt#'s libqtsharp for signal/slot connections
> > > on the C/C++ side of things when SMOKE will provide this for you. 
> > > Better to do it the SMOKE way since that is the binding library.
> >
> > Ok, I think I can do it now the 'non-SMOKE-way'. But I agree it would be
> > better to do it the SMOKE way. But what would that be?
>
> Yepp, I actually DID it the 'non-SMOKE-way'. I uploaded the modified files
> and commented them well, so it should be very easy to understand. Please
> note that libqtsharp.so from Qt# is needed.
> I know it is not very good to use the Qt#-way but it is a point from where
> we could start.
>
> http://www.arnorehn.de/programming/qyoto_signals.tar.gz

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.

-- 
Arno Rehn
arno at arnorehn.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qt3qyoto.cpp
Type: text/x-c++src
Size: 12908 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-bindings/attachments/20051227/3542da1a/attachment.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SmokeInvocation.cs
Type: text/x-c++src
Size: 14237 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-bindings/attachments/20051227/3542da1a/attachment-0001.cpp>


More information about the Kde-bindings mailing list