My question refers to:
How to verify QVariant of type QVariant::UserType is expected type?
Specifically, if
struct MyType {
....
};
Q_DECLARE_METATYPE(MyType);
QVariant v(QVariant::fromValue(MyType());
Is there a way to find out what v.userType() will return at compile-time?
There is no way to find this out at compile time, because it’s not determined until runtime. You can get it with
qMetaTypeId<MyType>().