Hiding a menu from the menu bar

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

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files, scripts and screenshots.

Post one question per topic.

Post Reply
User avatar
andrew
Site Admin
Posts: 9037
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: 9037
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 Programming, Script Programming and Contributing”