summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-06-10 14:58:06 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-06-10 15:02:57 (GMT)
commit060727ed4f8b1ffea58229817640a03be5b095ed (patch)
tree6a4e3865c251c1a895ff528b5cb1ec52527c7d30 /src
parent4a8a851315ba10824ac107084ccff9de649418ea (diff)
downloadQt-060727ed4f8b1ffea58229817640a03be5b095ed.zip
Qt-060727ed4f8b1ffea58229817640a03be5b095ed.tar.gz
Qt-060727ed4f8b1ffea58229817640a03be5b095ed.tar.bz2
Adding support in QVariant for conversions between QUrl and QString
Reviewed-by: ogoffart
Diffstat (limited to 'src')
-rw-r--r--src/corelib/kernel/qvariant.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index e6f1c48..a3434a4 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -591,6 +591,15 @@ static bool convert(const QVariant::Private *d, QVariant::Type t, void *result,
ok = &dummy;
switch (uint(t)) {
+ case QVariant::Url:
+ switch (d->type) {
+ case QVariant::String:
+ *static_cast<QUrl *>(result) = QUrl(*v_cast<QString>(d));
+ break;
+ default:
+ return false;
+ }
+ break;
case QVariant::String: {
QString *str = static_cast<QString *>(result);
switch (d->type) {
@@ -640,6 +649,8 @@ static bool convert(const QVariant::Private *d, QVariant::Type t, void *result,
if (v_cast<QStringList>(d)->count() == 1)
*str = v_cast<QStringList>(d)->at(0);
break;
+ case QVariant::Url:
+ *str = v_cast<QUrl>(d)->toString();
default:
return false;
}
@@ -2484,7 +2495,8 @@ static const quint32 qCanConvertMatrix[QVariant::LastCoreType + 1] =
/*QString*/ 1 << QVariant::StringList | 1 << QVariant::ByteArray | 1 << QVariant::Int
| 1 << QVariant::UInt | 1 << QVariant::Bool | 1 << QVariant::Double
| 1 << QVariant::Date | 1 << QVariant::Time | 1 << QVariant::DateTime
- | 1 << QVariant::LongLong | 1 << QVariant::ULongLong | 1 << QVariant::Char,
+ | 1 << QVariant::LongLong | 1 << QVariant::ULongLong | 1 << QVariant::Char
+ | 1 << QVariant::Url,
/*QStringList*/ 1 << QVariant::List | 1 << QVariant::String,
@@ -2499,7 +2511,7 @@ static const quint32 qCanConvertMatrix[QVariant::LastCoreType + 1] =
/*QDateTime*/ 1 << QVariant::String | 1 << QVariant::Date,
-/*QUrl*/ 0,
+/*QUrl*/ 1 << QVariant::String,
/*QLocale*/ 0,