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

Phil Thompson phil at riverbankcomputing.co.uk
Mon Nov 17 20:23:00 GMT 2003


On Monday 17 November 2003 2:59 pm, kscalet wrote:
> Hi,
>
> 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.

You can't.

> 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.

If your slot is a sub-class of QObject then use it's sender() method.

Phil




More information about the PyQt mailing list