exo
exo

Reputation: 385

How to add menu bar and toolbar into the qdialog

Exists any solution how to add menu or tool bar into the QWidget dialog?

I making something like ERP system. There are many windowses opening from others windowses. It's important that one (parent) window waiting for choices in children window. And in the chidren window sometimes I need toolbars and menu bars...

Problem is, that

Exists any solution (without events)? Solution how to add menu or tool bar to QDialog, or solution how to open new qmainwindow with waiting mode myMainWindow->exec()?

Upvotes: 0

Views: 1468

Answers (1)

exo
exo

Reputation: 385

Ok. I find solution. I used QDialog. Menu or tab bar will be added as: anylayout->addWidget(tabbar); or anylayout->setMenuBar(tabbar);

Thx for answer by Chris Kawa: The difference is that setMenuBar places the widget outside of the layout content, so the top margin of the layout is below the bar . With addWidget the bar is added as a layout content, so it respects the margins (controlled by setContentsMargins). For menus and toolbars we usually want them to stick to edges without a gap, so the setMenuBar method is more appropriate for it.

Upvotes: 0

Related Questions