[PyKDE] Need to know "who" triggers a callback?

Gordon Tyler gordon at doxxx.net
Mon Nov 17 18:48:01 GMT 2003


kscalet wrote:
> what would be the best approach in finding out, if a signal is send due 
> to a "real" gui action
> like key-presses and mouse-clicks, or due to a programmatic action like 
> setButton,
> setCurrentText, etc on a specific widget.
> It's often needed to trigger some action only in the former case, so I 
> assume, there is an easy
> way to find out the "source" of action, but did not find it out myself.

http://doc.trolltech.com/3.2/qobject.html#sender

However, I would suggest trying to find a different way of doing this. 
Perhaps set a flag when the signal handler should not do anything.

> Another slightly similar (well?) question, how can I find out the 
> sender(widget) of an action in my
> callback-function (slot-function). Normally I do not have an extra 
> argument, just "self" and the
> actual data, if any. This would be nice to know if I register the same 
> function to various actions.

http://doc.trolltech.com/3.2/qsignalmapper.html

Ciao,
Gordon





More information about the PyQt mailing list