[PyQt] Proposal for New-style Signals

Phil Thompson phil at riverbankcomputing.com
Thu Jan 24 12:21:35 GMT 2008

On Thursday 24 January 2008, Doug Bell wrote:
> Phil Thompson wrote:
> > About 4% of signals are overloaded. I think your point would be an issue
> > if that proportion was significantly higher, ie. if a newbie would be
> > likely to come across both short and long forms in, say, the tutorials.
> >
> > Of the overloaded signals, none of the overloads are obvious candidates
> > for being the default - so in those cases there would be no default and
> > the long form would have to be used. In fact the only use of the
> > "default" flag would probably be to preserve backwards compatibility in
> > the event of a later version of Qt introducing a new overload.
> Of the 13 overloaded signals, how many have "int" and "const QString&"
> choices?

11 might be squeezed into that category but only with a more complicated 
categorisation than an index or a string representation.

BTW, 23% of signals have no arguments - so maybe reserving the short form for 
that case is actually better.

> That seems to be the most common overload - giving either an 
> item's index or its string value.  Perhaps choosing either int or
> QString as the consistent default would make sense.  I'd suggest making
> int the default, since it's usually easier to get the string if you have
> the int than the reverse.

That's not an issue - both will always be available using the long form.

> This would be more consistent with the other 96% of signals, reducing
> the chance that a newby would need the long form.  And it would simplify
> things in cases where the slot doesn't need the value.

You mean they always use the short form as it doesn't matter which is the 
default (so long as one of them is)?


More information about the PyQt mailing list