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. menu item in the menu bar doesn't emit signal
Forum Update on Monday, May 27th 2025

menu item in the menu bar doesn't emit signal

Scheduled Pinned Locked Moved Solved General and Desktop
qmenubar
5 Posts 3 Posters 440 Views
  • 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.
  • rsswdevR Offline
    rsswdevR Offline
    rsswdev
    wrote on last edited by rsswdev
    #1

    Hi

    I would like to have a menu item in the menu bar.
    I can enable and disable it but no signal is emitted.

    QMenu *menubarItemTest = new QMenu(this);
    menubarItemTest->setTitle(tr("Test"));
    QAction *actionItemTest = ui->menubar->addMenu(menubarItemTest);
    addAction(actionItemTest);
    
    connect(menubarItemTest, &QMenu::triggered, this, &MainWindow::menuItemTestTriggered);
    connect(actionItemTest, &QAction::triggered, this, &MainWindow::actionItemTestTriggered);
    

    What am I doing wrong?
    Thanks

    Be patient, I am a bit different!

    M C 2 Replies Last reply
    0
    • rsswdevR Offline
      rsswdevR Offline
      rsswdev
      wrote on last edited by
      #5

      Widegts can be added to the MenuBar using the setCornerWidget() function.

      So far I have found a solution for myself.

      Be patient, I am a bit different!

      1 Reply Last reply
      0
      • rsswdevR rsswdev

        Hi

        I would like to have a menu item in the menu bar.
        I can enable and disable it but no signal is emitted.

        QMenu *menubarItemTest = new QMenu(this);
        menubarItemTest->setTitle(tr("Test"));
        QAction *actionItemTest = ui->menubar->addMenu(menubarItemTest);
        addAction(actionItemTest);
        
        connect(menubarItemTest, &QMenu::triggered, this, &MainWindow::menuItemTestTriggered);
        connect(actionItemTest, &QAction::triggered, this, &MainWindow::actionItemTestTriggered);
        

        What am I doing wrong?
        Thanks

        M Offline
        M Offline
        mpergand
        wrote on last edited by
        #2

        @rsswdev
        Menu doesn't trigger action, only menu items do.

        1 Reply Last reply
        1
        • rsswdevR rsswdev

          Hi

          I would like to have a menu item in the menu bar.
          I can enable and disable it but no signal is emitted.

          QMenu *menubarItemTest = new QMenu(this);
          menubarItemTest->setTitle(tr("Test"));
          QAction *actionItemTest = ui->menubar->addMenu(menubarItemTest);
          addAction(actionItemTest);
          
          connect(menubarItemTest, &QMenu::triggered, this, &MainWindow::menuItemTestTriggered);
          connect(actionItemTest, &QAction::triggered, this, &MainWindow::actionItemTestTriggered);
          

          What am I doing wrong?
          Thanks

          C Offline
          C Offline
          ChrisW67
          wrote on last edited by
          #3

          I can enable and disable it

          What is "it"? The QMenu or the action you added to the QMenu? (I am assuming that you actually called menubarItemTest->addAction(actionItemTest)

          but no signal is emitted.

          What signal are you expecting when you enable or disable it?

          rsswdevR 1 Reply Last reply
          0
          • C ChrisW67

            I can enable and disable it

            What is "it"? The QMenu or the action you added to the QMenu? (I am assuming that you actually called menubarItemTest->addAction(actionItemTest)

            but no signal is emitted.

            What signal are you expecting when you enable or disable it?

            rsswdevR Offline
            rsswdevR Offline
            rsswdev
            wrote on last edited by
            #4

            @ChrisW67

            @ChrisW67 said in menu item in the menu bar doesn't emit signal:

            What is "it"? The QMenu or the action you added to the QMenu? (I am assuming that you actually called menubarItemTest->addAction(actionItemTest)

            actionItemTest
            

            @ChrisW67 said in menu item in the menu bar doesn't emit signal:

            What signal are you expecting when you enable or disable it?

            connect(actionItemTest, &QAction::triggered, this, &MainWindow::actionItemTestTriggered);
            

            Be patient, I am a bit different!

            1 Reply Last reply
            0
            • rsswdevR Offline
              rsswdevR Offline
              rsswdev
              wrote on last edited by
              #5

              Widegts can be added to the MenuBar using the setCornerWidget() function.

              So far I have found a solution for myself.

              Be patient, I am a bit different!

              1 Reply Last reply
              0
              • rsswdevR rsswdev has marked this topic as solved on

              • Login

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