[PyQt] Proposal for New-style Signals

Doug Bell dougb at bellz.org
Thu Jan 24 12:40:47 GMT 2008


Phil Thompson wrote:
> On Thursday 24 January 2008, Doug Bell wrote:
> > 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.

I'd vote for a short form covering 96% of signals over one covering 23%.

> > 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.

Yes, both will be available.  I just meant that using the short form of
connect and then calling something like "widget.itemText(i)" would be an
acceptable approach as well.

> > 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)?

Something like that.  I was building on your earlier comment that
tutorials for newbies wouldn't need to show the long form.  The long
form could become quite rare if 96% have no overload and the remaining
4% have a sensible default.

Doug.


More information about the PyQt mailing list