Important: Please read the Qt Code of Conduct -

QAction not triggered ?

  • Hi, I'm porting my software from Qt4 to Qt5.

    @ QToolBar *myToolBar = new QToolBar(this);
    QAction *myAction = new QAction(myIcon, tr("Options"), this);

    QMenu *myMenu = new QMenu(this);
    QAction *myMenuAction1 = myMenu->addAction("Task 1");
    connect(myMenuAction1, SIGNAL(triggered()), this, SLOT(goMenu1()));
    // .. add more menu items ..
    myAction->setMenu(myMenu); @

    I can't get the triggered() signal from the menu actions. Previously I was using the activated() signal (oops - that was Qt3Support).

    When I click (and release) on a menu item, the slot is not called.

Log in to reply