[Kde-bindings] Qyoto: Delegates vs signals

David Canar davidcanar at gmail.com
Thu Sep 3 17:16:55 UTC 2009


On Wed, Sep 2, 2009 at 10:00 AM, Arno Rehn<arno at arnorehn.de> wrote:
> On Wednesday 02 September 2009 16:09:43 you wrote:
>> Hi Arno Rehn
>>
>> I'm the one who made the following bug:
>> https://bugs.kde.org/show_bug.cgi?id=205311
>>
>> I would really like to (or at least try to) dive a bit into the problem and
>> try to see if I can find something usable, but I'm not sure where to begin.
>> First off I'm a bit curious on why exactly do you actually need the ability
>> to overload signals?
> For the same reason you overload normal methods. And qt actually does overload
> signals in some of the classes. For example you have
>
> QComboBox::activated(int)
> QComboBox::activated(QString)
>
> How should we deal with that?

Just an idea for overloaded methods:

IMO you could add something like this:

public class ActivatedEventArgs : EventArgs
{
    public int index { get; set; }
    public string text { get; set; }
}

and to the QComboBox class something like this:

public event EventHandler<ActivatedEventArgs> Activated;

then you can do :

myComboBox.Activated += new
EventHandler<ActivatedEventArgs>(myComboBox_Activated);

which will send both the index and the text for the QComboBox when
activated (which personally I think it is better than sending those
values separate).

I think that will be a much better solution than the current
"this.Connect" stuff a whole lot more elegant and very C#ish.

Just my 2 cents.

David.



More information about the Kde-bindings mailing list