summaryrefslogtreecommitdiffstats
path: root/src/script/bridge
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-07-02 13:07:01 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-07-02 13:07:01 (GMT)
commit0357533025a7e4066def7665f3c77337f1ab21db (patch)
treea6aee166be2f9642035cba038c7adcb9e9c5aab2 /src/script/bridge
parent5d3ae53770a0b6ba0ad8c3271f6fcda72179c68e (diff)
downloadQt-0357533025a7e4066def7665f3c77337f1ab21db.zip
Qt-0357533025a7e4066def7665f3c77337f1ab21db.tar.gz
Qt-0357533025a7e4066def7665f3c77337f1ab21db.tar.bz2
implement string-->enum conversion
Diffstat (limited to 'src/script/bridge')
-rw-r--r--src/script/bridge/qscriptqobject.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp
index 716a0e4..8a77018 100644
--- a/src/script/bridge/qscriptqobject.cpp
+++ b/src/script/bridge/qscriptqobject.cpp
@@ -1254,7 +1254,15 @@ void QObjectWrapperObject::put(JSC::ExecState* exec, const JSC::Identifier& prop
if (prop.isScriptable()) {
if (!(opt & QScriptEngine::ExcludeSuperClassProperties)
|| (index >= meta->propertyOffset())) {
- QVariant v = eng->jscValueToVariant(value, prop.userType());
+ QVariant v;
+ if (prop.isEnumType() && value.isString()
+ && !eng->hasDemarshalFunction(prop.userType())) {
+ // give QMetaProperty::write() a chance to convert from
+ // string to enum value
+ v = qtStringFromJSCUString(value.toString(exec));
+ } else {
+ v = eng->jscValueToVariant(value, prop.userType());
+ }
(void)prop.write(qobject, v);
return;
}