summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qmlcompiler.cpp
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2009-08-27 01:01:55 (GMT)
committerMartin Jones <martin.jones@nokia.com>2009-08-27 01:01:55 (GMT)
commita488a04e5a5af4255d560d5dfa6423caa48ed5f3 (patch)
tree67250667a40c39da3a343e538bc6960891390195 /src/declarative/qml/qmlcompiler.cpp
parent1b489edbc2c8897ba6cbca4214e998c7d7873e67 (diff)
downloadQt-a488a04e5a5af4255d560d5dfa6423caa48ed5f3.zip
Qt-a488a04e5a5af4255d560d5dfa6423caa48ed5f3.tar.gz
Qt-a488a04e5a5af4255d560d5dfa6423caa48ed5f3.tar.bz2
Make QmlPropertyValueSource an interface.
1st step in animation class heirarchy redesign.
Diffstat (limited to 'src/declarative/qml/qmlcompiler.cpp')
-rw-r--r--src/declarative/qml/qmlcompiler.cpp29
1 files changed, 9 insertions, 20 deletions
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp
index bbcc64d..3af7137 100644
--- a/src/declarative/qml/qmlcompiler.cpp
+++ b/src/declarative/qml/qmlcompiler.cpp
@@ -1411,7 +1411,6 @@ void QmlCompiler::genPropertyAssignment(QmlParser::Property *prop,
}
} else if (v->type == Value::ValueSource) {
-
genObject(v->object);
QmlInstruction store;
@@ -1425,6 +1424,8 @@ void QmlCompiler::genPropertyAssignment(QmlParser::Property *prop,
QmlMetaPropertyPrivate::saveProperty(prop->index);
store.assignValueSource.owner = 0;
}
+ QmlType *valueType = QmlMetaType::qmlType(v->object->metatype);
+ store.assignValueSource.castValue = valueType->propertyValueSourceCast();
output->bytecode << store;
} else if (v->type == Value::PropertyBinding) {
@@ -1584,15 +1585,7 @@ bool QmlCompiler::buildValueTypeProperty(QObject *type,
Value *value = prop->values.at(0);
if (value->object) {
- const QMetaObject *c =
- output->types.at(value->object->type).metaObject();
- bool isPropertyValue = false;
- while (c && !isPropertyValue) {
- isPropertyValue =
- (c == &QmlPropertyValueSource::staticMetaObject);
- c = c->superClass();
- }
-
+ bool isPropertyValue = output->types.at(value->object->type).type->propertyValueSourceCast() != -1;
if (!isPropertyValue) {
COMPILE_EXCEPTION(prop, "Invalid property use");
} else {
@@ -1762,30 +1755,26 @@ bool QmlCompiler::buildPropertyObjectAssignment(QmlParser::Property *prop,
v->object->metatype = output->types.at(v->object->type).metaObject();
Q_ASSERT(v->object->metaObject());
+ // Will be true if the assigned type inherits QmlPropertyValueSource
+ bool isPropertyValue = false;
+ if (QmlType *valueType = QmlMetaType::qmlType(v->object->metatype))
+ isPropertyValue = valueType->propertyValueSourceCast() != -1;
+
// We want to raw metaObject here as the raw metaobject is the
// actual property type before we applied any extensions that might
// effect the properties on the type, but don't effect assignability
const QMetaObject *propertyMetaObject =
QmlMetaType::rawMetaObjectForType(prop->type);
- // Will be true if the assigned type inherits QmlPropertyValueSource
- bool isPropertyValue = false;
// Will be true if the assgned type inherits propertyMetaObject
bool isAssignable = false;
- // Determine isPropertyValue and isAssignable values
+ // Determine isAssignable value
if (propertyMetaObject) {
const QMetaObject *c = v->object->metatype;
while(c) {
- isPropertyValue |= (c == &QmlPropertyValueSource::staticMetaObject);
isAssignable |= (c == propertyMetaObject);
c = c->superClass();
}
- } else {
- const QMetaObject *c = v->object->metatype;
- while(!isPropertyValue && c) {
- isPropertyValue |= (c == &QmlPropertyValueSource::staticMetaObject);
- c = c->superClass();
- }
}
if (isAssignable) {