Bug 205311 - [Qyoto] Usage of delegates over "connections" desired
Summary: [Qyoto] Usage of delegates over "connections" desired
Status: RESOLVED NOT A BUG
Alias: None
Product: bindings
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR wishlist
Target Milestone: ---
Assignee: kde-bindings
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-27 10:46 UTC by Rohde Fischer
Modified: 2009-08-29 02:38 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.