Can the type of the template be used in any way as an argument to a slot or signal? As an example, I am trying to determine the following:
void exampleSignal(std::map<non_template_type_1,non_template_type_2> arg); void exampleSlot(std::map<non_template_type_1,non_template_type_2> arg);
As a result, at runtime, this leads to the following:
QObject::connect: Cannot queue arguments of type 'std::map<non_template_type_1,non_template_type_2>' (Make sure 'std::map<non_template_type_1,non_template_type_2>' is registered using qRegisterMetaType().)
Attempting to register std::map<non_template_type_1,non_template_type_2> with Q_DECLARE_METATYPE() leads to compilation failure and, apparently, is not supported.
As a workaround, I use QVariantMap instead of std::map . But I really would like to know the right way to solve this problem; where it is impossible to change the template classes.
Edit: I forgot to mention that the signal and slot are emitted and received in different streams. Apparently, a runtime error does not occur in single-thread scripts.
source share