Hiding a menu from the menu bar

Discussion forum for contributors and developers who are using the QCAD ECMAScript development platform or the C++ plugin interface or who are otherwise looking to contribute to QCAD (translations, documentation, etc).

Moderator: andrew

Post Reply
User avatar
andrew
Site Admin
Posts: 5604
Joined: Fri Mar 30, 2007 6:07 am

Hiding a menu from the menu bar

Post by andrew » Fri Mar 23, 2018 10:09 am

From a QCAD user:
How do I hide a complete menu from the menu bar (for example the Misc menu)?

User avatar
andrew
Site Admin
Posts: 5604
Joined: Fri Mar 30, 2007 6:07 am

Re: Hiding a menu from the menu bar

Post by andrew » Fri Mar 23, 2018 10:10 am

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);

Post Reply

Return to “QCAD Developers and Contributors”