[PyQt] default action names

Scott Frankel frankel at circlesfx.com
Fri Oct 23 00:30:34 BST 2009

On Oct 22, 2009, at 2:55 PM, Baz Walter wrote:

> Scott Frankel wrote:
>> On Oct 22, 2009, at 10:57 AM, Baz Walter wrote:
>>> Scott Frankel wrote:
>>>> Does a QMainWindow, or an app based on, one contain a list of  
>>>> default action names?
>>>> I'm trying to add an action called "Settings" to my app.  The  
>>>> addAction() method silently fails unless I rename or misspell the  
>>>> action, like "Foo" or "Setttings."
>>>> Actions named "Settings", "Preferences", "Configuration" all  
>>>> silently fail.
>>>> Trying to find what names may already be claimed, my invocations  
>>>> of the actions() method always return an empty list.
>>> it would help if you posted a complete example that demonstrates  
>>> the problem. the above code snippet doesn't show the action being  
>>> added to anything. are you trying add actions to a menu in the  
>>> menubar, or are you trying to create a context menu?
>> I'm using addAction to add the action to the app's main menu.
>> See simple, running code sample attached.  Note line 59.  The  
>> action's first arg is misspelled "Setttings."  Using the correct  
>> spelling, the action silently fails to be added to the menu.
> sorry, but it works perfectly fine for me. that is, i changed the  
> spelling to "Settings...", and that's exactly how it appears in the  
> menu.

Very strange.  I've double-checked that the code I emailed does not  
work for me.  I'm on OSX 10.5.8, Qt 4.5.2, and PyQt 4.5.4.  I realize  
I'm a few versions out of date.

> what happens if you replace line 70 with:
> print repr(self.fileMenu.addAction('Settings'))

<PyQt4.QtGui.QAction object at 0x7b618>

... and the file menu contains the entry, "Settings."



More information about the PyQt mailing list