aboutsummaryrefslogtreecommitdiff
path: root/tests/utils
diff options
context:
space:
mode:
Diffstat (limited to 'tests/utils')
-rw-r--r--tests/utils/qdbus-helpers.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/utils/qdbus-helpers.h b/tests/utils/qdbus-helpers.h
new file mode 100644
index 0000000..f873e23
--- /dev/null
+++ b/tests/utils/qdbus-helpers.h
@@ -0,0 +1,21 @@
+#pragma once
+
+#define QT_NO_KEYWORDS
+#include <QDBusArgument>
+#include <QVariant>
+
+bool qDBusArgumentToMap(QVariant const& variant, QVariantMap& map)
+{
+ if (variant.canConvert<QDBusArgument>())
+ {
+ QDBusArgument value(variant.value<QDBusArgument>());
+ if (value.currentType() == QDBusArgument::MapType)
+ {
+ value >> map;
+ return true;
+ }
+ }
+
+ return false;
+}
+