[Qgis-developer] Problem in Connecting three different signals to the same event handler

Martin Dobias wonder.sk at gmail.com
Tue Apr 13 05:18:09 EDT 2010


Hi Bishwarup

On Thu, Apr 8, 2010 at 4:22 PM, Bishwarup Banerjee
<bishwarup.banerjee at gmail.com> wrote:
> Dear All,
>
> I am struck with a problem while handling Signal and slot through pyqt
>
> The problem is as follows:
>
> I have three different menu items, each connected to the same event.
> In side my event handling function , I want to find out which menu item was
> clicked.
>
> I tried self.sender().objectName(),
>
> But I get the following error: ("TF is my class name")
>
> AttributeError: TF instance has no attribute 'sender'
>
> When I tried to inherit the QObject class in my class, the above error is
> gone, but instead of getting the message "inside" it is not showing
> anything. (Neither the error message nor the "inside" message).

Your class _must_ inherit from QObject (directly or by inheriting a
class derived from QObject) otherwise sender() method won't be
present.
When using the message box, it doesn't show up at all or it is
displayed but doesn't show any message?
Anyway, you can use some 'print' statements for debugging.


Bye
Martin


More information about the Qgis-developer mailing list