[Kde-bindings] Qyoto: SIGNALS/SLOTS

Arno Rehn kde-bindings at arnorehn.de
Sat Dec 17 19:43:08 UTC 2005


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 
"_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.

-- 
Arno Rehn
arno at arnorehn.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signaltest.cs
Type: text/x-c++src
Size: 1122 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-bindings/attachments/20051217/9e64697c/attachment.cpp>


More information about the Kde-bindings mailing list