[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    RE: [PyQt] simpler 'connect' function
From:       "Peter Shinners" <pshinners () blizzard ! com>
Date:       2008-01-17 17:27:19
Message-ID: EFF2EC227B08C542A0A947FF5D1A99F106323D7C () BL-EXCHANGE ! corp ! blizzard ! net
[Download RAW message or body]

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.

combo.activated[int].connect(callback1)
combo.activated[QString].connect(callback2)

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.

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic