diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2016-03-17 09:25:23 -0500 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2016-03-17 09:25:23 -0500 |
commit | 65eba5e107b0499aec4bed55be202bf1df6710bb (patch) | |
tree | 6bb113dc095b2b5db19bd318441aeaf1b596d475 /tests/utils | |
parent | 3ef931c4bc8d87497dbe9f6ceda9ce4ca3bb116f (diff) | |
download | ayatana-indicator-display-65eba5e107b0499aec4bed55be202bf1df6710bb.tar.gz ayatana-indicator-display-65eba5e107b0499aec4bed55be202bf1df6710bb.tar.bz2 ayatana-indicator-display-65eba5e107b0499aec4bed55be202bf1df6710bb.zip |
add tests/utils/qdbus-helpers.h so that we only define qDBusArgumentToMap() in one place
Diffstat (limited to 'tests/utils')
-rw-r--r-- | tests/utils/qdbus-helpers.h | 21 |
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; +} + |