[Kde-bindings] Qyoto: SIGNALS/SLOTS

Arno Rehn kde-bindings at arnorehn.de
Sat Dec 17 20:21:11 UTC 2005


Am Samstag, 17. Dezember 2005 21:14 schrieb Adam Treat:
> On Saturday December 17 2005 2:43 pm, Arno Rehn wrote:
> > Am Donnerstag, 15. Dezember 2005 14:32 schrieb Arno Rehn:
> > > Am Mittwoch, 14. Dezember 2005 20:22 schrieb Adam Treat:
> > > > On Wednesday December 14 2005 1:43 pm, you wrote:
> > > > > Hi,
> > > > >
> > > > > I found the following in you code:
> > > > > IntPtr s = (this.Instance as QtSharp).RawObject;
> > > > >
> > > > > does 'RawObject' point to the underlying C++ instance?
> > > > > If it does, a second question: How do I get the pointer to the
> > > > > C++-instance? It tried it with 'GCHandle.Alloc' but that doesn't
> > > > > seem to work.
> > > >
> > > > Yes, it does.  You can find the code for RawObject and the handling
> > > > of C++ pointer interaction in the attached file.
> > >
> > > Thanks, but here I referr to the smoke-lib. I think we can use the
> > > functions of libqtsharp to connect signals to slots. I just wanted to
> > > try to use libqtsharp with the smoke-bindings. Therefore I would need
> > > to get the pointer to the instance of the object in the smoke-lib.
> >
> > OK, here is what I try to do: I want to use libqtsharp to connect a
> > signal to a slot. I looked in the files Adam sent and discovered how he
> > connects a signal to a C#-delegate. He uses 'RawObject' to get the
> > pointer to the C++-instance. I want to connect a signal to a delegate in
> > the same way, but I need to get the pointer to the C++-instance created
> > by smoke. I changed
>
> I would be leary of trying to connect directly to libqtsharp.  It is a huge
> library and is Qt#'s equivalent to the smoke library.  Why don't you
> extract the few signal/slot C methods from the library and build it
> yourself and then see how that is done.

I only connect to 'libqtsharp.so". The library has a size of 314kb. That isn't 
very much and when I look at the sources, they don't provide more than 
connecting signals/slots. What should I extract there?

> Here are the relevant files:
>
> http://cvs.sourceforge.net/viewcvs.py/qtcsharp/qtsharp/src/newlibqtsharp/st
>atic/
>
> > "_smokeObject" (in Qt.cs) from "private" to "public" to access it
> > outsides the class. I then tried to call 'csharp_connect_void' to connect
> > a signal to a delegate but that failed. I think '_smokeObject' doesn't
> > point to the real C++-instance. I attached my code.
> > Maybe Richard can help getting the appropiate IntPtr needed for the
> > function-call.
>
> Adam

-- 
Arno Rehn
arno at arnorehn.de



More information about the Kde-bindings mailing list