We can define static slots .
auto action = menu->addAction("edit");
QObject::connect(action,
&QAction
::triggered,onClicked
);
return menu;
}
Q_SLOT static void onClicked(){
throw;
}
QMenu* getMenu(){
QMenu* menu = new QMenu;
auto action = menu->addAction("edit");
QObject::connect(action,&QAction::triggered,onClicked);
return menu;
}
Q_SLOT static void onClicked(){
throw;
}
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 ?
Bookmarks