[Kde-bindings] Qyoto: SIGNALS/SLOTS
Arno Rehn
arno at arnorehn.de
Tue Dec 13 18:10:47 UTC 2005
Am Dienstag, 13. Dezember 2005 18:10 schrieb Adam Treat:
> Hi all, I've been watching your discussion of SIGNALS/SLOTS for Qyoto and I
> wanted to offer up how this was solved in Qt# as I think it might reduce
> the work for you guys...
>
> Attached are three files that should be pretty much self contained drop in
> replacements for a signal/slot binding for Qyoto. The first one
> 'SigSlots.cs' will give you signal/slot functionality for C# <--> C#
> signals/slots and the second one 'NativeSigSlots.cs' will give you C++ <-->
> C# signals/slots as well as C# <--> C++ signals/slots.
>
> Finally, the file 'emit.cs' will show you how it all works.
>
> Here is what it looks like:
>
> namespace QtSamples
> {
> using Qt;
> using System;
>
> public class EmitSample: QVBox
> {
> public EmitSample (): base ()
> {
> QPushButton pb = new QPushButton ("Emit Sample",
> this);
>
> //pb.SIGNAL["Clicked()"] +=
> this.SIGNAL["EmitStuff()"];
> //this.SIGNAL["EmitStuff()"] +=
> this.SLOT["PrintStuff()"];
> }
>
> [SIGNAL]
> public void EmitStuff ()
> {
> Emit("EmitStuff()");
> }
>
> [SLOT]
> public void PrintStuff ()
> {
> Console.WriteLine ("Emitted 'EmitStuff()'");
> }
>
> public static void Main (string[] args)
> {
> QApplication app = new QApplication (args);
> EmitSample es = new EmitSample ();
> app.SetMainWidget (es);
> es.Show ();
> app.Exec ();
> }
> }
> }
>
> Feel free to use or ignore as is you like.
>
Thanks, I've already taken a look at how it was done in Qt#.
It doesn't really fit with the system of delegates (I still think we can do
that), but it's a good clue.
--
MfG
Arno Rehn
arno at arnorehn.de
More information about the Kde-bindings
mailing list