diff options
author | Bea Lam <bea.lam@nokia.com> | 2011-01-04 05:03:53 (GMT) |
---|---|---|
committer | Bea Lam <bea.lam@nokia.com> | 2011-01-04 05:03:53 (GMT) |
commit | 086f33dd4c70be03adcbc1703997afa27add920b (patch) | |
tree | 77c5231b519808393b4027515e17a0a55c162d43 /src/declarative | |
parent | 59ec08d255b7d7bd8975bdbfd0b0a42c1b6ed2a0 (diff) | |
download | Qt-086f33dd4c70be03adcbc1703997afa27add920b.zip Qt-086f33dd4c70be03adcbc1703997afa27add920b.tar.gz Qt-086f33dd4c70be03adcbc1703997afa27add920b.tar.bz2 |
Fix results of number() queries for zero and non-number values
Use xs:string() to test whether a value is empty, instead of using a
simple boolean check which fails for zero-type values. This fix also
means 'NaN' is returned for non-number (including empty) values.
Task-number: QTBUG-16423, QTBUG-16265
Reviewed-by: Michael Brasser
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/util/qdeclarativexmllistmodel.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index 49a12b1..f5c3ad4 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -382,7 +382,7 @@ void QDeclarativeXmlQuery::doSubQueryJob() for (int i = 0; i < queries.size(); ++i) { QList<QVariant> resultList; if (!queries[i].isEmpty()) { - subquery.setQuery(m_prefix + QLatin1String("(let $v := ") + queries[i] + QLatin1String(" return if ($v) then ") + queries[i] + QLatin1String(" else \"\")")); + subquery.setQuery(m_prefix + QLatin1String("(let $v := string(") + queries[i] + QLatin1String(") return if ($v) then ") + queries[i] + QLatin1String(" else \"\")")); if (subquery.isValid()) { QXmlResultItems resultItems; subquery.evaluateTo(&resultItems); |