summaryrefslogtreecommitdiffstats
path: root/tests/auto/qdbusmarshall/common.h
diff options
context:
space:
mode:
authorMartin Smith <msmith@trolltech.com>2009-08-31 08:40:12 (GMT)
committerMartin Smith <msmith@trolltech.com>2009-08-31 08:40:12 (GMT)
commit734badac98a81b6a1937dc94ac52839c52eee8a9 (patch)
tree12419f5ce18c593a843c76ad57f1f3bce9526cf1 /tests/auto/qdbusmarshall/common.h
parent68dc7ed9338eb555eb78d9993490434284bdc223 (diff)
parent174bef24f10242b042dad626f8b68a95bdfb7ac7 (diff)
downloadQt-734badac98a81b6a1937dc94ac52839c52eee8a9.zip
Qt-734badac98a81b6a1937dc94ac52839c52eee8a9.tar.gz
Qt-734badac98a81b6a1937dc94ac52839c52eee8a9.tar.bz2
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt into 4.6
Diffstat (limited to 'tests/auto/qdbusmarshall/common.h')
-rw-r--r--tests/auto/qdbusmarshall/common.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/auto/qdbusmarshall/common.h b/tests/auto/qdbusmarshall/common.h
index 9df1e01..bdc9f09 100644
--- a/tests/auto/qdbusmarshall/common.h
+++ b/tests/auto/qdbusmarshall/common.h
@@ -103,6 +103,34 @@ const QDBusArgument &operator>>(const QDBusArgument &arg, MyStruct &ms)
return arg;
}
+struct MyVariantMapStruct
+{
+ QString s;
+ QVariantMap map;
+
+ inline bool operator==(const MyVariantMapStruct &other) const
+ { return s == other.s && map == other.map; }
+};
+Q_DECLARE_METATYPE(MyVariantMapStruct)
+Q_DECLARE_METATYPE(QList<MyVariantMapStruct>)
+
+QDBusArgument &operator<<(QDBusArgument &arg, const MyVariantMapStruct &ms)
+{
+ arg.beginStructure();
+ arg << ms.s << ms.map;
+ arg.endStructure();
+ return arg;
+}
+
+const QDBusArgument &operator>>(const QDBusArgument &arg, MyVariantMapStruct &ms)
+{
+ arg.beginStructure();
+ arg >> ms.s >> ms.map;
+ arg.endStructure();
+ return arg;
+}
+
+
void commonInit()
{
qDBusRegisterMetaType<QList<QDateTime> >();
@@ -127,6 +155,8 @@ void commonInit()
qDBusRegisterMetaType<QHash<QDBusSignature, QString> >();
qDBusRegisterMetaType<MyStruct>();
+ qDBusRegisterMetaType<MyVariantMapStruct>();
+ qDBusRegisterMetaType<QList<MyVariantMapStruct> >();
}
#ifdef USE_PRIVATE_CODE
#include "private/qdbusintrospection_p.h"
@@ -476,6 +506,11 @@ bool compareToArgument(const QDBusArgument &arg, const QVariant &v2)
else if (id == qMetaTypeId<MyStruct>())
return compare<MyStruct>(arg, v2);
+
+ else if (id == qMetaTypeId<MyVariantMapStruct>())
+ return compare<MyVariantMapStruct>(arg, v2);
+ else if (id == qMetaTypeId<QList<MyVariantMapStruct> >())
+ return compare<QList<MyVariantMapStruct> >(arg, v2);
}
qWarning() << "Unexpected QVariant type" << v2.userType()