For various reasons I would like to move my creation of menu actions to a thread. I thought I should be able to do this with "invokeMethod", but I am having problems.

Essentially, I would like to replace this code
Qt Code:
  1. blah = ui->menuCurves->addAction("ActionText");
To copy to clipboard, switch view to plain text mode 
with this code
Qt Code:
  1. QMetaObject::invokeMethod(ui->menuCurves, "addAction",
  2. Qt::QueuedConnection, Q_RETURN_ARG(QAction*, blah), Q_ARG(QString, "ActionText"));
To copy to clipboard, switch view to plain text mode 

Using invokeMethod, the code runs but 'blah' is not a valid pointer and nothing is added to the 'menuCurves' menu.

I feel like I am close, but what is wrong???