The proper use of QSignalMapper

David Boddie david at
Thu Jan 18 16:59:07 CET 2007

borntonetwork wrote:
> Thanks, David, for you help.
> When I change the slot function to what you show in your second
> example, I get the same results: nothing.

This may be due to something I missed in your code. When you
connect the signal from the signal mapper to your class, you
need to specify the signal as a C++ signature as well:

        self.connect(self.signalMapper, QtCore.SIGNAL(

The second example should now work.

Looking at the first example, which uses SLOT() rather than specifying
a Python method, the following might be due to the way you call
connect, though it is surprising:

> When I change it to what you
> have in your first example, I get the following:
> Object::connect: No such slot QApplication::map()
> Object::connect:  (sender name:   'chkProductIngredientsDelete_1')
> Object::connect:  (receiver name: '')


It looks like you should try something like this:

             self.connect(w, QtCore.SIGNAL("stateChanged(int)"),

I can't understand why calling would cause the
connection to be attempted between self.signalMapper and

Maybe someone on the PyQt/PyKDE mailing list would be able to
explain the behaviour you're seeing:


More information about the Python-list mailing list