Solved Use a main menu as a submenu
-
Hello everyone,
I created a GUI with Qt designer. I use a QStackedWidget to make me 4 pages. And I would like to navigate between these pages with the menu bar. Like a style of website.
I know how to do it from a "submenu". For example, i create a submenu to "config", create an action and set up in .cpp :
void MainWindow::on_actionGo_To_Config_triggered() { ui->stackedWidget->setCurrentIndex(3); }.
It works.
The problem is that I do not want to do it from a submenu, i dont want submenu, but Qmenu directly. And there, I can not find information. An idea ?
Thank you
-
@R3dp1ll
Hi
Im not sure you can do from Designer directly ( didnt check)
but you sure can from code
https://stackoverflow.com/questions/6370793/how-to-assign-a-signal-to-a-qmenu-instead-of-qaction-in-qt
You dont have to new other QMenuBar, you can use that one from UI -
I had seen this solution before posted, when i had done my research. I tried many ways but I can not do it.
In fact, for me, sometimes it's hard to put in relation signals / Slots between QT designer and Qt creator.
Well I give up, I will use a QTabWidget and then that's it. Thank you very much for the info anyway.
Have a nice day ;)