[Solved]How can I hide Qmenu object of the menuBar?

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
oscarchan
Posts: 47
Joined: Mon Apr 11, 2022 2:04 am

[Solved]How can I hide Qmenu object of the menuBar?

Post by oscarchan »

How can I hide the "Part Design" Qmenu object below?
I tried to call hide() or setvisibility(False) .But it failed.
Qmenu.png
Qmenu.png (38.9 KiB) Viewed 482 times
Thank you!
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: How can I hide Qmenu object of the menuBar?

Post by openBrain »

Code: Select all

from PySide2 import QtWidgets
Gui.getMainWindow().findChild(QtWidgets.QMenu, '&Part Design').menuAction().setVisible(False)
oscarchan
Posts: 47
Joined: Mon Apr 11, 2022 2:04 am

Re: How can I hide Qmenu object of the menuBar?

Post by oscarchan »

Thank you so much! It works!
Thank you!
Post Reply