[PyQt] simpler 'connect' function

Peter Shinners pshinners at blizzard.com
Thu Jan 17 17:27:19 GMT 2008

Ewald de Wit
> Wouldn't it be nicer if the signals where attributes of your object,
> so that you could write
> 	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.


This sort of matches the syntax the "clr" library is using to bind to
dotnet generic functions. This could still lead to ambiguities where a
signal argument used variations on the same type (reference vs pointer
vs const). 

Another thing to keep in mind is defining new slots on custom classes.
Declaring them statically on the class would be a closer match to what
C++ Qt does, but a departure from existing Pyqt code.

class MyObject(QObject):
    forgotten = QtCore.SLOT()
    remembered = QtCore.SLOT([QString])
    perhaps = QtCore.SLOT_shortCircuit()

Interesting ideas. But I don't really have problems with the existing
connect function. If we could just get rid of the SIGNAL requirement and
pass a string argument it would get a whole lot nicer.

More information about the PyQt mailing list