[PyQt] findChildren(): default for type?

Giovanni Bajo rasky at develer.com
Sun Mar 8 12:41:08 GMT 2009


On sab, 2009-03-07 at 17:39 +0000, Phil Thompson wrote:
> On Sat, 07 Mar 2009 18:11:30 +0100, Giovanni Bajo <rasky at develer.com>
> wrote:
> > Hello,
> > 
> > any reason why findChild() / findChildren() don't support a default for
> the
> > "type" argument (which would be QObject of course) like they do in C++?
> 
> As they are template methods don't you always have to specify the type from
> C++?

I could have sworn there was a non-template overload in C++, but I was
wrong. So I'll probably have to raise this with Trolltech first.

> > In
> > PyQt I'm always forced to write code like this:
> > 
> >   groupBox.findChild(QWidget, "theLabel")
> > 
> > instead of:
> > 
> >   groupBox.findChild("theLabel")
> > 
> > I believe this could be done in a fully backward compatible way, right?
> If
> > so, we can prepare a patch.
> 
> The obvious way is to just add an extra overload for each that doesn't take
> the type argument. Is that what you were thinking?

Yes.
-- 
Giovanni Bajo
Develer S.r.l.
http://www.develer.com




More information about the PyQt mailing list