I want to use an enum as the user data in QComboBox, say MyClass::MyEnum. But when I tried to get this data using QComboBox::itemData(UserRole), I cannot convert it to this enum. I read the docs and add Q_ENUMS(MyEnum) in myclass.h, but it doesn't work. The enum is only a util class's data, there is no need to set it as a property, how should I do if I want to convert QVariant to custom enum?
Bookmarks