Kimvais
Kimvais

Reputation: 39548

How to change the application menu name in PyQt4 on OS X

I'm porting a PyQt4 (PySide) application that I wrote for Linux and Windows to OS X, menus seem to be otherwise OK out of the box (i.e. Help menu that only has About in it is magically moved to the "main menu" and a File menu is created just fine, but the "main" menu is titled Python instead of Application name.

I call self.setWindowTitle("Appname") in MainWindow.__init__() and self.setApplicationName("Appname") in Application.__init__() but the result is this:

Screenshot of menu bar

How can I fix this? - Preferably in a way that my app still looks the same as it did before on Windows & Linux.

Upvotes: 4

Views: 1626

Answers (1)

Jeff
Jeff

Reputation: 7210

So it looks like Mac does something different than the other OS systems. I don't have a Mac so I can't really test it out but I think on a Mac the QMainWindow.menuBar() function does not return the application wide menu bar. You might try creating menubar like.

menubar = QtGui.MenuBar()

that has no parent.

I'm getting this information from the following links.

From the documents

Deploying an Application on Mac OS X

Also, it looks like the file Info.plist in "The Bundle" section of the second link is where the application name would live.

I'm sorry I can't be of more help but I hope this information will help you. Good luck!

Upvotes: 1

Related Questions