Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide Qt widget application menu bar?

By default when creating a new Qt Widget project using Qt Creator. There's a menu bar, and it is shown always even without any menus, sub menus or actions. I don't want to delete this menu bar in designer view, just want to hide it only. Any solution?

like image 448
jondinham Avatar asked Jan 23 '26 11:01

jondinham


1 Answers

try

ui->menuBar->hide(); // hide menubar
ui->menuBar->show(); // in case you want to restore it

in your mainwindow class if you want to hide it in the runtime.

Otherwise, you don't have to create a project with mainwindow.ui everytime. As you start a new project, there's an option in [Details]->[Base class] which allows you to choose the base class (template form) as mainwindow, dialog or widget.

like image 186
Tay2510 Avatar answered Jan 25 '26 01:01

Tay2510



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!