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. the reasons of the QAction not execute triggered?
Forum Updated to NodeBB v4.3 + New Features

the reasons of the QAction not execute triggered?

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 224 Views 1 Watching
  • 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.
  • P Offline
    P Offline
    Princein
    wrote on last edited by
    #1

    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")));
    	    TwoDAction->setPriority(QAction::HighPriority);
    		connect(TwoDAction,SIGNAL(triggered()),this,SLOT(onAddParentItem()));
    		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()));
    	    menu->exec(QCursor::pos());
    
    
    

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

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      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 ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

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