The proper use of QSignalMapper
david at boddie.org.uk
Thu Jan 18 16:59:07 CET 2007
> 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:
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: 'main.py')
It looks like you should try something like this:
I can't understand why calling self.app.connect() would cause the
connection to be attempted between self.signalMapper and self.app.
Maybe someone on the PyQt/PyKDE mailing list would be able to
explain the behaviour you're seeing:
More information about the Python-list