summaryrefslogtreecommitdiffstats
path: root/src/xmlpatterns
diff options
context:
space:
mode:
authorPeter Hartmann <peter.hartmann@trolltech.com>2009-08-06 12:30:26 (GMT)
committerPeter Hartmann <peter.hartmann@trolltech.com>2009-09-03 11:50:00 (GMT)
commit98aee81ccc17c0fe5d7e013fc40ca171dc2ebb43 (patch)
tree3fbc237da6ecc6557727aa5c9547d5713380a5a8 /src/xmlpatterns
parent06153cadcc6c253491879af29f9843765f519354 (diff)
downloadQt-98aee81ccc17c0fe5d7e013fc40ca171dc2ebb43.zip
Qt-98aee81ccc17c0fe5d7e013fc40ca171dc2ebb43.tar.gz
Qt-98aee81ccc17c0fe5d7e013fc40ca171dc2ebb43.tar.bz2
XQuery: allow usage of floats in QXmlQuery
float is not a registered type in QVariant, but a QVariant can be constructed from it and then used in XQuery. Reviewed-by: Frans Englich
Diffstat (limited to 'src/xmlpatterns')
-rw-r--r--src/xmlpatterns/data/qatomicvalue.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/xmlpatterns/data/qatomicvalue.cpp b/src/xmlpatterns/data/qatomicvalue.cpp
index d8186e5..3aca100 100644
--- a/src/xmlpatterns/data/qatomicvalue.cpp
+++ b/src/xmlpatterns/data/qatomicvalue.cpp
@@ -172,13 +172,19 @@ Item AtomicValue::toXDM(const QVariant &value)
return Item(Double::fromValue(value.toDouble()));
default:
{
- Q_ASSERT_X(false,
- Q_FUNC_INFO,
- qPrintable(QString::fromLatin1(
- "QVariants of type %1 are not supported in "
- "Patternist, see the documentation")
+ if (value.userType() == qMetaTypeId<float>())
+ {
+ return Item(Float::fromValue(value.value<float>()));
+ }
+ else {
+ Q_ASSERT_X(false,
+ Q_FUNC_INFO,
+ qPrintable(QString::fromLatin1(
+ "QVariants of type %1 are not supported in "
+ "Patternist, see the documentation")
.arg(QLatin1String(value.typeName()))));
- return AtomicValue::Ptr();
+ return AtomicValue::Ptr();
+ }
}
}
}