How to return deleted main menu bar?
General and Desktop
5
Posts
3
Posters
2.0k
Views
1
Watching
-
I don't quite inderstand what you want it to do. From the QMainWindow::menuBar() doc entry:
bq. Returns the menu bar for the main window. This function creates and returns an empty menu bar if the menu bar does not exist.
This means that calling this function when you have no menuBar will yield you a new, empty one - you just need to specify your intentions regarding its use.
-
Why do you use a QMainWindow at all? Maybe a QDialog would be better then.
Anyway, I think you can remove the menubar like this:
@QList<QMenuBar*> widgets = this->findChildren<QMenuBar*>();QMenuBar *current = NULL;
foreach(current, widgets)
{
delete current;
}@--
EDIT: Sorry, I misunderstood. Though OP is looking to remove the menubar.