简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM