We can define static slots .

Qt Code:
  1. QMenu* getMenu(){
  2. QMenu* menu = new QMenu;
  3. auto action = menu->addAction("edit");
  4.  
  5. QObject::connect(action,&QAction::triggered,onClicked);
  6.  
  7. return menu;
  8. }
  9.  
  10. Q_SLOT static void onClicked(){
  11. throw;
  12. }
To copy to clipboard, switch view to plain text mode 

Just I wonder that how to get whos the sender ? Is there a direct way to get it ?