menu item in the menu bar doesn't emit signal
Solved
General and Desktop
-
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 -
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?
-
@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);
-