Page 1 of 1

Hiding a menu from the menu bar

Posted: Fri Mar 23, 2018 10:09 am
by andrew
From a QCAD user:
How do I hide a complete menu from the menu bar (for example the Misc menu)?

Re: Hiding a menu from the menu bar

Posted: Fri Mar 23, 2018 10:10 am
by andrew
In Qt, the action that triggers the menu (QAction) has to be hidden, not the menu item (QMenu).

To hide an individual tool:

Code: Select all

var a = RGuiAction.getByScriptFile("scripts/Path/To/Original/Tool/Tool.js");
a.setVisible(false);
To hide a main menu (for example the Misc menu) from the menu bar:

Code: Select all

var m = Misc.getMenu();
var a = m.menuAction();
a.setVisible(false);
or

Code: Select all

var appWin = EAction.getMainWindow()
var m = appWin.findChild("MiscMenu");
var a = m.menuAction();
a.setVisible(false);