mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 18:50:00 +02:00
Nest TextureType JS interface in Type
This commit is contained in:
parent
c2909946e6
commit
de8145ec71
1 changed files with 5 additions and 1 deletions
|
@ -37,9 +37,13 @@ TextureCache::TextureCache() {
|
||||||
setObjectName("TextureCache");
|
setObjectName("TextureCache");
|
||||||
|
|
||||||
// Expose enum Type to JS/QML via properties
|
// 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>();
|
auto metaEnum = QMetaEnum::fromType<Type>();
|
||||||
for (int i = 0; i < metaEnum.keyCount(); ++i) {
|
for (int i = 0; i < metaEnum.keyCount(); ++i) {
|
||||||
setProperty(metaEnum.key(i), metaEnum.value(i));
|
type->setProperty(metaEnum.key(i), metaEnum.value(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue