Unsolved QVariant::value returns empty while it has data.
-
I have a type which I've already registered:
Q_DECLARE_METATYPE(MyType*)
I've filled it with a pointer of my class but when getting its value this way:
auto* instance = myVariant.value<MyType*>();
it returns nullptr.
I went through qt source code and it seems that it fails on type casting but my types are the same within the same module and library.What should I do you experts?
-
Hi and welcome to devnet,
Show the exact code you are using to load your custom custom class pointer in that QVariant.
Even better, provide a minimal compilable example that shows your issue.