summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qmlcompiler.cpp
diff options
context:
space:
mode:
authorRhys Weatherley <rhys.weatherley@nokia.com>2009-08-21 03:16:51 (GMT)
committerRhys Weatherley <rhys.weatherley@nokia.com>2009-08-21 03:16:51 (GMT)
commit7eb52559f44de7666c31ea28ce557eaca9177e9d (patch)
tree757b9927465409fc6a005a50bfe57322ec0824b9 /src/declarative/qml/qmlcompiler.cpp
parent0fd79d739bf102e406a8042eb20add5b1e8ebb10 (diff)
downloadQt-7eb52559f44de7666c31ea28ce557eaca9177e9d.zip
Qt-7eb52559f44de7666c31ea28ce557eaca9177e9d.tar.gz
Qt-7eb52559f44de7666c31ea28ce557eaca9177e9d.tar.bz2
Make QVector3D a first-class builtin type within QML
Reviewed-by: Martin Jones
Diffstat (limited to 'src/declarative/qml/qmlcompiler.cpp')
-rw-r--r--src/declarative/qml/qmlcompiler.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp
index afc8698..1fb4b46 100644
--- a/src/declarative/qml/qmlcompiler.cpp
+++ b/src/declarative/qml/qmlcompiler.cpp
@@ -297,6 +297,13 @@ bool QmlCompiler::testLiteralAssignment(const QMetaProperty &prop,
if (!v->value.isBoolean()) COMPILE_EXCEPTION(v, "Invalid property assignment: boolean expected");
}
break;
+ case QVariant::Vector3D:
+ {
+ bool ok;
+ QVector3D point = QmlStringConverters::vector3DFromString(string, &ok);
+ if (!ok) COMPILE_EXCEPTION(v, "Invalid property assignment: 3D vector expected");
+ }
+ break;
default:
{
int t = prop.type();
@@ -487,6 +494,18 @@ void QmlCompiler::genLiteralAssignment(const QMetaProperty &prop,
instr.storeBool.value = b;
}
break;
+ case QVariant::Vector3D:
+ {
+ bool ok;
+ QVector3D vector =
+ QmlStringConverters::vector3DFromString(string, &ok);
+ float data[] = { vector.x(), vector.y(), vector.z() };
+ int index = output->indexForFloat(data, 3);
+ instr.type = QmlInstruction::StoreVector3D;
+ instr.storeRealPair.propertyIndex = prop.propertyIndex();
+ instr.storeRealPair.valueIndex = index;
+ }
+ break;
default:
{
int t = prop.type();