summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-10-09 08:32:30 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-10-09 08:32:30 (GMT)
commit3b3213679a35cdfb1eedcd5b27e6c40f1eca45fd (patch)
treebb7636c7aa078e346a81b2f317198a320e94fc15 /src/declarative
parent3995e86d68b2f9958156da3b51d50609b748d220 (diff)
downloadQt-3b3213679a35cdfb1eedcd5b27e6c40f1eca45fd.zip
Qt-3b3213679a35cdfb1eedcd5b27e6c40f1eca45fd.tar.gz
Qt-3b3213679a35cdfb1eedcd5b27e6c40f1eca45fd.tar.bz2
Support aliases to enum properties
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/qml/qmlcompiler.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp
index 5e6a8aa..8856892 100644
--- a/src/declarative/qml/qmlcompiler.cpp
+++ b/src/declarative/qml/qmlcompiler.cpp
@@ -2253,10 +2253,13 @@ bool QmlCompiler::compileAlias(QMetaObjectBuilder &builder,
data.append((const char *)&idObject->idIndex, sizeof(idObject->idIndex));
data.append((const char *)&propIdx, sizeof(propIdx));
+ const char *typeName = aliasProperty.typeName();
+ if (aliasProperty.isEnumType())
+ typeName = "int"; // Avoid introducing a dependency on the aliased metaobject
+
builder.addSignal(prop.name + "Changed()");
QMetaPropertyBuilder propBuilder =
- builder.addProperty(prop.name, aliasProperty.typeName(),
- builder.methodCount() - 1);
+ builder.addProperty(prop.name, typeName, builder.methodCount() - 1);
propBuilder.setScriptable(true);
return true;
}