KLayout allows installing macros as menu entries. Each time that menu entry is selected, the macro will be executed. To configure a macro for installation in the menu, open the macro in the macro development environment and open the macro properties dialog.
The macro is configured to be shown in the menu by checking the "Show in menu" check box. That also enables two other fields: the menu path and the group name.
The menu path specifies the position where the macro shall be put. A macro path is a sequence of symbolic names separated by a dot. For example:
To obtain a list of the paths available, have a look at the "Key Bindings" page in the "Application" section of the setup dialog ("File/Setup").
The pseudo element "end" denotes the position after the last entry. The same way "begin" indicates the first entry in the menu. The macro will be inserted before the entry indicated by the path. Hence:
If a plus sign follows the macro path element, the new element is inserted after this element. For example:
A special form can be used to generate new groups: if the given element does not exist, the menu generator can be instructed to create it by appending the insert point plus the new text string to the element after a ">" character. For example:
If no macro path is specified, the macro is inserted in the "Macros" menu. The description of the macro is used as the menu title. If a shortcut is specified, that shortcut is used for the macro entry as well.
The group name can be used to group together all menu entries with the same group name. Any text is allowed here. A group is separated from the other entries in the menu by a separator line. It is recommended to use the group feature in conjunction with a "end"-terminated menu path which is identical for all entries of the same group. Other uses cases are possible, but the result is not defined.
The Qt/MacOS combination does not allow for dynamically configuring the main menu. On MacOS the behavior is as follows:
Every top-level menu entry that is generated either by code or by configuring a macro correspondingly, will be shown in a separate entry in the main toolbar. This entry is labelled "..." and is shown only when it is populated. All non-standard main menu entries are placed there in the same order they would appear in the main menu.