From pykde Thu Jan 17 23:34:58 2008 From: Phil Thompson Date: Thu, 17 Jan 2008 23:34:58 +0000 To: pykde Subject: Re: [PyQt] simpler 'connect' function Message-Id: <200801172334.58791.phil () riverbankcomputing ! co ! uk> X-MARC-Message: https://marc.info/?l=pykde&m=120061343713279 On Thursday 17 January 2008, Ewald de Wit wrote: > On Thursday 17 January 2008 18:27:19 Peter Shinners wrote: > > > button.clicked.connect(self.onButtonClicked) > > > > Is there a clean way to handle signals with the same name that take > > different arguments? Here's an idea I can think of for QComboBox. > > > > combo.activated[int].connect(callback1) > > combo.activated[QString].connect(callback2) The problem with this approach is that you can't represent all C++ argument types with Python types. > A simpler way would be to just give the signal objects a different name, > like activatedInt and activatedString. It's the easiest way to uniquely > specify which signal you mean. The problem with this is that things can get clunky - focusChangedQWidgetPtrQWidgetPtr for example. Those that don't like strings because they can't be type checked are wrong. They can be type checked against Qt signals (see QMetaObject::indexOfSignal()). The problem is that they can't be distinguished from Python signals which are not pre-defined. My prefered option at the moment is just not to support Python signals in any new approach - short-circuit signals would have to be used instead (which don't have parentheses and are therefore easy to distinguish from Qt signals). Phil _______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt