[PyQt] Is the result of SIGNAL() a constant?

Phil Thompson phil at riverbankcomputing.co.uk
Wed Jan 9 11:06:30 GMT 2008


On Wednesday 09 January 2008, Henrik Pauli wrote:
> On Wednesday 09 January 2008, Aaron Digulla wrote:
> > > type(SIGNAL('')) would show that it is just a string.
> >
> > That confuses me a bit because when I try to pass a string as the
> > second argument to connect, I get "argument 2 has a wrong type" :)
> >
> > But anyway: How much work would it be to have SIP generate constants
> > for all SIGNAL's in a class? So I could say:
> >
> >      self.connect(w1, w1.SOME_SIGNAL, ...)
> >
> > Pro: Doesn't break old code, API, etc. No more typos (or python will
> > warn about a missing attribute) and PyDev could offer auto-completion
> > for signals, too!
>
> Contra: doesn’t look like Qt at all, and it’d be rather hard to know just
> what to call different signals — especially ones sharing a name but
> differing in signature.

It's on the TODO list but I haven't thought through all the issues yet - 
particularly this one.

What would the equivalents of the following be called?

SIGNAL('foo()')
SIGNAL('foo(const QString &)')
SIGNAL('foo(QString *, QWidget *)')

Phil



More information about the PyQt mailing list