I have a QMap
like this:
QVariantMap dictionary;
dictionary.insert("name", KeywordType::name);
but when I try to retrieve the value of name
key as enum KeywordType
type, which is KeywordType::name
it return none (that's zero in the KeywordType
enum):
qDebug() << dictionary["name"].value<KeywordType>();
How do i fix this?
the enum type is registered to moc, it use:
Q_ENUM(KeywordType)
Q_DECLARE_METATYPE(keywords::KeywordType)
and
qRegisterMetaType<KeywordType>("KeywordType");
to make know the typeded:
typedef keywords::KeywordType KeywordType;