diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-06-09 01:16:41 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-06-09 01:16:41 (GMT) |
commit | 991b41aa407b5a8740e6899a3efdc724276dcb95 (patch) | |
tree | 09704bd06a87731269f9571abd9943e010923853 /src/declarative/qml/qmlcompiler.cpp | |
parent | ef4378dd282ed51098d1366792e46e9cfbde727a (diff) | |
download | Qt-991b41aa407b5a8740e6899a3efdc724276dcb95.zip Qt-991b41aa407b5a8740e6899a3efdc724276dcb95.tar.gz Qt-991b41aa407b5a8740e6899a3efdc724276dcb95.tar.bz2 |
Fix handling of qreal properties.
This is to bring us in line with the fix made to moc's handling of qreal
properties.
Diffstat (limited to 'src/declarative/qml/qmlcompiler.cpp')
-rw-r--r-- | src/declarative/qml/qmlcompiler.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index 46695b7..b28d7dd 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -262,7 +262,7 @@ bool QmlCompiler::compileStoreInstruction(QmlInstruction &instr, instr.storeInteger.value = value; return true; } - int type = prop.type(); + int type = prop.userType(); switch(type) { case -1: { @@ -300,16 +300,26 @@ bool QmlCompiler::compileStoreInstruction(QmlInstruction &instr, instr.storeInteger.value = value; } break; - case 135: - case QVariant::Double: + case QMetaType::Float: { - instr.type = QmlInstruction::StoreReal; - instr.storeReal.propertyIndex = prop.propertyIndex(); + instr.type = QmlInstruction::StoreFloat; + instr.storeFloat.propertyIndex = prop.propertyIndex(); bool ok; float value = string.toFloat(&ok); if (!ok) - COMPILE_EXCEPTION2(v, "Cannot convert value" << string << "to real number"); - instr.storeReal.value = value; + COMPILE_EXCEPTION2(v, "Cannot convert value" << string << "to float number"); + instr.storeFloat.value = value; + } + break; + case QVariant::Double: + { + instr.type = QmlInstruction::StoreDouble; + instr.storeDouble.propertyIndex = prop.propertyIndex(); + bool ok; + double value = string.toDouble(&ok); + if (!ok) + COMPILE_EXCEPTION2(v, "Cannot convert value" << string << "to double number"); + instr.storeDouble.value = value; } break; case QVariant::Color: |