[PySide] finding slot that QAction's signal is connect to

Frank Rueter | OHUfx frank at ohufx.com
Mon Jul 7 15:02:30 CEST 2014


Hi Dermot,

thanks for your reply.
 >>At some point in the code you should find a connect method being 
called that links the QAction object to a method.

That's what I thought so I searched the entire code repository for 
"connect" as well as "QAction" and even "QMenu" and "addItem". I 
couldn't even find the label I'm seeing in the UI for the particular 
QAction (QAction.text) anywhere in the repo, that's when I got stumped.

I should have mentioned that the host application is written in C++, 
though most UI elements like the menu in question are written in PySide. 
I can find some of the menu's actions but not the one who's trigger I 
need to back trace to the slots.

I will talk to the developers and see what the hell is going on. I'm 
starting to suspect that this bit of the code is compiled, which is why 
I was wondering how I can figure out the connected slots from the 
QAction itself (I can get to that one easily).

Cheers,
frank


On 6/07/14 9:59 PM, Dermot Doran wrote:
> Hi Frank,
>
> I'm fairly new to PySide, but I think I might be able to help here.
> At some point in the code you should find a connect method being
> called that links the QAction object to a method.
> Here is a very simple example from some of my code:
>
> self.connect(self.help_about, SIGNAL('triggered()'),
> self.ctl.handle_help_about_action)
>
> In this line of code the QAction object (self.help_about) is being
> associated with a method in an object called
> self.ctl.handle_help_about_action.
>
> At some point in the code you are reviewing there must be a similar
> type of statement.  Is this application implemented using the MVC
> (Model-View-Controller) pattern?  If that is the case you may find the
> "connect" method in some of the Controller code.
>
> I hope this gives you a bit of help with your continued search for the
> answer to your question.
>
> Cheers!!
>
> Dermot.
>
>
> On 6 July 2014 09:17, Frank Rueter | OHUfx <frank at ohufx.com> wrote:
>> Hi all,
>>
>> I have been away from PySide for a while now so I hope this is not to
>> dumb a question:
>>
>> I need to investigate some code flow in an existing application that
>> uses QT/PySide for it's UI, in particular I need to find out what
>> function/method/slot a given QAction is triggering, but I'm having
>> difficulties.
>> I can find the QAction itself and modify it's text etc (just to ensure
>> I'm looking at the right one). But I can't figure out how to get to the
>> method it triggers.
>>
>> Am I just missing the obvious or is it not as easy as it may seem?
>>
>>
>> Cheers,
>> frank
>>
>> --
>> VFX COMPOSITING | WORKFLOW CUSTOMISATION AND CONSULTING
>> _______________________________________________
>> PySide mailing list
>> PySide at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/pyside




More information about the PySide mailing list