One way to catch the result of a menu is to do this :
QAction* action = menu.exec(QCursor::pos());
Then you can use
action->text()==QString("ftp")
To know if the user clicked on "FTP".
So as said by Frank Osterfeld in the comments, you can also create a slot in you class, and connect menu trigger action signal to it :
connect(&menu, SIGNAL(triggered(QAction*)), this, SLOT( sl_OnMenuTriggered(QAction* )));
void sl_OnMenuTriggered(QAction* _action)
{
if(_action->text()=="ftp") ...
}
This is the "non blocking" way.