>>>>> "Andreas" == Andreas Vox <[EMAIL PROTECTED]> writes:

Andreas> I thought that was the purpose of this hack? What were you
Andreas> trying to achieve in the first place?

OK, in OSX there are three menu entries that are in an unconventional
position: Quit, About and Preferences. Therefore Qt tries to be very
smart and finds these menu entries _by_name_ and moves them. This
means in particular that entries like 'Paragraph Settings..' will be
moved if we do nothing about it.

There are two solutions:
1 disable the qt menu hack, and have an application that does not
really look like an OSX app.

2 try to be more devilish than qt.

Here is what solution 2 does: there is a special menu in stdmenus.ui
that contains the menu entries we would like to move. When expanding
the menus, we remove these entries, so that qt is not going to find
them. 

Then we add the entries at the end of the file menu, where they do not
hurt because we know qt is going to find them and remove them anyway.
Why do we do this strange thing? Mainly because our menus are
generated on the fly and qt does not see all of them when he parses
the whole QMenubar to populate the OSX native menubar.

These entries at the end of the file menu are associated with an index
which is position_in_menu + indexOffset (where the later is an
arbitrary large constant). When an index with such a large value is
found, the code detects that it is a special menu item, and executes
the right thing.

Then there is a separate place where we assert that strings like
"Setting" should be translated to "do_not_translate_me" in menus. This
forbids qt from finding all these "Paragraph settings..." strings and
eat them.

This is ugly, yes. But qt menu code is uglier.

JMarc

Reply via email to