[Qt-interest] How to use QVariant with enum?
程梁
chengliang.soft at gmail.com
Sat Dec 25 17:47:57 CET 2010
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?
--
Cheng Liang
from: chengliang.soft at gmail.com
More information about the Qt-interest-old
mailing list