ReflectedEnumModel::ReflectedEnumModel(const PropertyAccessor& pA, ObjectHandleT<MetaEnumObj> enumObj) { const wchar_t* enumString = enumObj->getEnumString(); if (enumString != nullptr) { generateFromString(items_, enumString); return; } Collection collection = enumObj->generateEnum(pA.getObject()); auto it = collection.begin(); auto itEnd = collection.end(); for (; it != itEnd; ++it) { int index; it.key().tryCast(index); Variant itValue = it.value(); std::string text; itValue.tryCast(text); items_.push_back(new ReflectedEnumItem(index, text)); } }