summaryrefslogtreecommitdiffstats
path: root/src/script/bridge/qscriptvariant.cpp
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-08-27 10:28:21 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-08-27 11:33:35 (GMT)
commita5c4c8453ac68f847b1bc3b4e01f710b757e7e1b (patch)
treeef689c4d9619665b224c374d5d18816ba4484034 /src/script/bridge/qscriptvariant.cpp
parent2c18dd72d51efffa64ed54f058c64f6e4fc5c597 (diff)
downloadQt-a5c4c8453ac68f847b1bc3b4e01f710b757e7e1b.zip
Qt-a5c4c8453ac68f847b1bc3b4e01f710b757e7e1b.tar.gz
Qt-a5c4c8453ac68f847b1bc3b4e01f710b757e7e1b.tar.bz2
fix whacky behavior of QScriptValue::toString() for QVariant
For some types, an empty string is the correct and complete conversion of the type. If the result is an empty string, use QVariant::canConvert() to determine if that is indeed correct, before falling back to the "string-conversion-not-available" path.
Diffstat (limited to 'src/script/bridge/qscriptvariant.cpp')
-rw-r--r--src/script/bridge/qscriptvariant.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/script/bridge/qscriptvariant.cpp b/src/script/bridge/qscriptvariant.cpp
index c4a152a..ab75a02 100644
--- a/src/script/bridge/qscriptvariant.cpp
+++ b/src/script/bridge/qscriptvariant.cpp
@@ -137,7 +137,7 @@ static JSC::JSValue JSC_HOST_CALL variantProtoFuncToString(JSC::ExecState *exec,
JSC::JSValue value = variantProtoFuncValueOf(exec, callee, thisValue, args);
if (value.isObject()) {
result = v.toString();
- if (result.isEmpty()) {
+ if (result.isEmpty() && !v.canConvert(QVariant::String)) {
result = "QVariant(";
result += v.typeName();
result += ")";