I have my custom type:
enum class MyType : int {
TYPENAME1 = 0,
TYPENAME2 = 1,
TYPENAME3 = 2
};
I need to convert MyType to QVariant. I tried qDebug() << QVariant::fromValue(value) but I received " " instead of property value.
For QVariant to store a custom type, you need the type to be registered with the qt meta object system.
Q_ENUMorQ_ENUM_NSin the header of the typeqRegisterMetaType<MyType>()called sometime before you try to use the type with QVariant (usually setup somewhere that is called when your app starts)