Bug 205311

Summary: [Qyoto] Usage of delegates over "connections" desired
Product: [Developer tools] bindings Reporter: Rohde Fischer <krdata>
Component: generalAssignee: kde-bindings
Status: RESOLVED NOT A BUG    
Severity: wishlist CC: arno
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:

Description Rohde Fischer 2009-08-27 10:46:04 UTC
Version:            (using KDE 4.3.0)
OS:                Linux
Installed from:    Ubuntu Packages

First off, I'm sorry for the bad choice of application, there was no proper options for this. I hope someone will correct this.

The thing is simple, since Qyoto is a .net-binding for KDE it's desired to use delegates rather than that connect method to attach an action for a button.

A code like this:
this.Connect(quit, SIGNAL("clicked()"), qApp, SLOT("quit()"));

should look either of these:
quit.Click += delegate {
   QApplication.Quit(); // Or whatever method that is appropiate
}

og like

quit.Click += QuitClick;

public void QuitClick(object sender, EventArgs args)
{
   QApplication.Quit();
}

as you would do with delegates.
Comment 1 Arno Rehn 2009-08-29 02:38:34 UTC
You can already connect a signal to a delegate with

Connect(this, SIGNAL("foo()"), delegate {
    Console.WriteLine("Hello World!");
});

The problem with mapping signals to .NET events is that signals can be overloaded, but events can't.

I'm thinking about using a syntax like
Connect<int>(this.Signals.Foo, this.Foo) to make it easier to use signals and slots, but this is still not really .NET-like.

If you have ideas on how to improve the situation, feel free to post them here or (better) send them to kde-bindings@kde.org. :)

Closing this as invalid for now.