Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Use a main menu as a submenu
Forum Updated to NodeBB v4.3 + New Features

Use a main menu as a submenu

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 485 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    R3dp1ll
    wrote on last edited by
    #1

    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

    mrjjM 1 Reply Last reply
    0
    • R R3dp1ll

      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

      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @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

      1 Reply Last reply
      3
      • R Offline
        R Offline
        R3dp1ll
        wrote on last edited by
        #3

        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 ;)

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved