Nest TextureType JS interface in Type

This commit is contained in:
Zach Pomerantz 2016-04-27 16:47:18 -07:00
parent c2909946e6
commit de8145ec71

View file

@ -37,9 +37,13 @@ TextureCache::TextureCache() {
setObjectName("TextureCache");
// Expose enum Type to JS/QML via properties
// Despite being one-off, this should be fine, because TextureCache is a SINGLETON_DEPENDENCY
QObject* type = new QObject(this);
type->setObjectName("TextureType");
setProperty("Type", QVariant::fromValue(type));
auto metaEnum = QMetaEnum::fromType<Type>();
for (int i = 0; i < metaEnum.keyCount(); ++i) {
setProperty(metaEnum.key(i), metaEnum.value(i));
type->setProperty(metaEnum.key(i), metaEnum.value(i));
}
}