Is it possible to determine QMetaType::Type value of a template argument.
I tried this:
template <class T>
class MyClass {
public:
    int getType() {
        return QMetaType::type(typeid(T).name());
    }
};
But this returns always 0 (QMetaType::UnknownType) because Qt uses different type names than the compiler.
It should work like the following:
MyClass<int>().getType();     // 2 (QMetaType::Int)
MyClass<QString>().getType(); // 10 (QMetaType::QString)
MyClass<QRect>().getType();   // 19 (QMetaType::QRect)
MyClass<MyType>().getType();  // 1024 (Set by qRegisterMetaType)
 
                        
I tested your code on Qt 5.12.4 and it seems to work. You could also Q_DECLARE_METATYPE to register your custom type and then use qMetaTypeId() to get the metaType id.
Here my test code and example:
this outputs: