I am having trouble emit()ing a QHash<QString, QVariant> ...

when I do

Qt Code:
  1. QHash<QString, QVariant> payload;
  2. payload["variable"]="abc";
  3.  
  4. emit(doCommand(payload));
To copy to clipboard, switch view to plain text mode 

and then

Qt Code:
  1. void receiver::doCommand(QHash<QString, QVariant> command)
  2. {
  3. qDebug() << "The variable was: " << command["variable"].toString();
  4. }
To copy to clipboard, switch view to plain text mode 

I end up with an empty string.

Do I have to register the QHash type, or create a typedef, or is the problem that because "payload" in the first piece of code is not a pointer, and therefore can fall out of scope, it is deleted, or perhaps it cannot be passed by value?

It seems that when I emit a signal with a container (or perhaps just a template), the data gets lost.