[PyQt] menu items not working on windows: activated vs triggered

Lee Harr missive at hotmail.com
Mon Sep 19 20:18:38 BST 2011


I maintain an application written using PyQt
(pynguin.googlecode.com)

The other day I received a bug report saying that almost
none of the menu items were working on windows.

The user would click on the menu item and there would
be no error message, just nothing would happen, like
the menu item was not connected.

On my system (ubuntu linux) the menus worked fine.


Today I found a windows computer I could play around
with and when I looked at the ui file in the Qt Designer
there, all of my menu items showed in the Signal/Slot
editor as connected to signal activated(), but as soon
as I would click on one to see what other signals are
available, activated was no longer an option.

Once I set them all to signal triggered() the menu items
work normally. Seems to work properly on linux as well.


So, just a heads up. Make sure you don't select activated()
for your QAction menu items. Choose triggered() instead.

 		 	   		  


More information about the PyQt mailing list