Important: Please read the Qt Code of Conduct -

the reasons of the QAction not execute triggered?

  • Hi:
    I developed a cross-platform qt app which can work on the windows and mac, in my app, there is a menu and the menu has four QAction, in the most times, the QAction singal triggered can execute when I click the QAction,occasionally, I click the QAction which in the menu, the QAction singal triggered can't execute anymore,but this situation only appears on macos, the app work well on Windows,here is my code :

    	    QMenu *menu = new QMenu;
    		QAction *TwoDAction = menu->addAction((QIcon(":/TestBed/FUEditor/data/qt/add.png")), QString(tr("2D Item")));
    		QAction *ThreeDAction = menu->addAction((QIcon(":/TestBed/FUEditor/data/qt/add.png")), QString(tr("3D Item")), this, SLOT(onAddParentItem()));
    		QAction *ARAction = menu->addAction((QIcon(":/TestBed/FUEditor/data/qt/add.png")), QString(tr("AR Mesh")), this, SLOT(onAddParentItem()));
    		QAction *AnimAction = menu->addAction((QIcon(":/TestBed/FUEditor/data/qt/add.png")), QString(tr("Anim")), this, SLOT(onAddParentItem()));

    I don't know why, but I want to know the possible reasons of the QAction not execute triggered, thanks a lot!

  • Lifetime Qt Champion


    The code itself looks correct.

    What version of Qt are you using ?
    What version of macOS are you running ?
    Can you provide a minimal compilable examples that reproduces this ?

Log in to reply