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.
  • R Offline
    R Offline
    rsswdev
    wrote on 15 Aug 2023, 23:39 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 16 Aug 2023, 00:07
    0
    • R Offline
      R Offline
      rsswdev
      wrote on 29 Aug 2023, 23:07 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
      • R rsswdev
        15 Aug 2023, 23:39

        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 16 Aug 2023, 00:07 last edited by
        #2

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

        1 Reply Last reply
        1
        • R rsswdev
          15 Aug 2023, 23:39

          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 16 Aug 2023, 01:52 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?

          R 1 Reply Last reply 29 Aug 2023, 22:56
          0
          • C ChrisW67
            16 Aug 2023, 01:52

            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?

            R Offline
            R Offline
            rsswdev
            wrote on 29 Aug 2023, 22:56 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
            • R Offline
              R Offline
              rsswdev
              wrote on 29 Aug 2023, 23:07 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
              • R rsswdev has marked this topic as solved on 29 Aug 2023, 23:07

              • Login

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