[PyQt] signals and slots

Andreas Pakulat apaku at gmx.de
Thu Jul 17 10:20:25 BST 2008


On 17.07.08 09:54:40, Strato wrote:
> Hi Folks,
>
> Thanks Russel for your answer, but I'm not able to figure out how my  
> argument can be the correct one that way... Maybe I'm not as skilled as  
> I need to realy understand hot this works...
>
> hum seems that your style is in pure Qt, but I'm writing PyQt.
>
> so, maybe an example will be the best way to explain my needs:
>
> I have a popup menu, with entry generated by iteration, each entry is a  
> submenu, and all sub menus are the same entry.
>
> I can use QAction and its 'activated()' signal when I click on an item  
> of a sub-menu, but I need to know which of the sub-menu is activated, to  
> call my slot with the correct argument(s).

Look at the QSignalMapper class, it does exactly what you want. Connect
the actions 'activated' signal to the mapper's 'map' slot, and its
'mapped(int)' signal to your own slot. Then use
'setMapping(action,somenumber)' to activate the mapping.

Andreas

-- 
You will be held hostage by a radical group.


More information about the PyQt mailing list