[SOLVED] Adding QMenubar under every tab of QTabWidget
-
Hi
I'm trying to find a way to insert a custom menubar for every TAB of QTabWidget. I just could not find any satisfying soulution! Please help me to figure it out.
Thank you
-
You can't really add a menu to a tab directly, but there's a workaround. The only assumption is that the content widget of the tab has a layout (no matter what type). Layouts have a
setMenuBar()
method so you can sneak the menu there like this:int numTabs = tabWidget()->count(); for(int i = 0; i < numTabs; ++i) tabWidget->widget(i)->layout()->setMenuBar(yourMenuBar);
-
@Chris-Kawa omg YES! You are AWESOME! i was cracking my head all day trying to find a solution... Thank you! but Is it possible to realize from QT Designer?
-
@Streakflash
Yeah Chris rocks :)You cant do it in designer
but you can do it in mainwin constructor after setupIU
it would just be
ui-> tabWidget->widgetIf you have added it "visually".
-
@Streakflash
Yeah I agree. But a lot of stuff is not really possible from Designer. Sadly.