[Qt-jambi-interest] Quit menu

Gunnar Sletta gunnar at trolltech.com
Wed Mar 5 08:41:20 CET 2008


Peter Dove wrote:
> Hi,
> 
> Perhaps I am missing something, but when I try to create a menu action  
> Quit - it never appears in the menu bar. This is for Mac.
> 
> In the code posted below, all menus appear except Quit.Excuse the odd  
> names... a sign of my perplexity...
>           
> actionQuit 
> .setText 
> (com.trolltech.qt.core.QCoreApplication.translate("MainWindow",  
> "Quit"));

Hi Peter,

What you are seeing here is an effect of Qt / C++ being a bit to clever 
for Qt Jambi. In Qt / C++ we try to make the mac menu actions fit into 
their appropriate sub-menus, meaning that "quit" and "about" go into the 
application menu rather than the file and help menu which is common on 
windows.

What happens in your case is that your quit action is moved into the app 
menu, but Java already has a "quit" action there so your action is lost. 
  I'll make a task to investigate how we can solve this problem more 
gracefully.

In the meantime, you can work around this by disabling this feature. 
This is done by setting the actions MenuRole to NoRole:

   actionQuit.setMenuRole(QAction.MenuRole.NoRole);

For more information see the documentation:
http://doc.trolltech.com/qtjambi-4.3.3_01/com/trolltech/qt/gui/QAction.html#setMenuRole(com.trolltech.qt.gui.QAction.MenuRole)

best regards,
Gunnar



More information about the Qt-jambi-interest mailing list