aboutsummaryrefslogtreecommitdiff
path: root/libqmenumodel/src
diff options
context:
space:
mode:
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2016-10-18 12:53:27 +0200
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2016-10-18 12:53:27 +0200
commite87701e0f2d5f3b7dd291c7b8c62e407b5abf4c7 (patch)
tree3ed7a1053b5ee5aa4a5130164f3b5e859a344447 /libqmenumodel/src
parent3edd18dc46ebb95962f17de0c77ee72f469fd917 (diff)
downloadqmenumodel-e87701e0f2d5f3b7dd291c7b8c62e407b5abf4c7.tar.gz
qmenumodel-e87701e0f2d5f3b7dd291c7b8c62e407b5abf4c7.tar.bz2
qmenumodel-e87701e0f2d5f3b7dd291c7b8c62e407b5abf4c7.zip
Converter: add bytestring support
Diffstat (limited to 'libqmenumodel/src')
-rw-r--r--libqmenumodel/src/converter.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/libqmenumodel/src/converter.cpp b/libqmenumodel/src/converter.cpp
index 527ae85..91cafab 100644
--- a/libqmenumodel/src/converter.cpp
+++ b/libqmenumodel/src/converter.cpp
@@ -58,6 +58,11 @@ QVariant Converter::toQVariant(GVariant *value)
gsize size = 0;
const gchar *v = g_variant_get_string(value, &size);
result.setValue(QString::fromUtf8(v, size));
+ } else if (g_variant_type_equal(type, G_VARIANT_TYPE_BYTESTRING)) {
+ gsize size = 0;
+ gchar *bs = g_variant_dup_bytestring(value, &size);
+ result.setValue(QByteArray::fromRawData(bs, size));
+ g_free(bs);
} else if (g_variant_type_equal(type, G_VARIANT_TYPE_VARIANT)) {
GVariant *var = g_variant_get_variant(value);
result = toQVariant(var);
@@ -111,7 +116,6 @@ QVariant Converter::toQVariant(GVariant *value)
* G_VARIANT_TYPE_DICT_ENTRY
* G_VARIANT_TYPE_DICTIONARY
* G_VARIANT_TYPE_STRING_ARRAY
- * G_VARIANT_TYPE_BYTESTRING
* G_VARIANT_TYPE_OBJECT_PATH_ARRAY
* G_VARIANT_TYPE_BYTESTRING_ARRAY
*/