diff options
author | Robert Tari <robert@tari.in> | 2023-07-12 02:29:31 +0200 |
---|---|---|
committer | Robert Tari <robert@tari.in> | 2023-07-12 02:29:31 +0200 |
commit | 08289ff0e7457d75682390fc8e926f11f2386045 (patch) | |
tree | 277ace6cc89d03650e368ce15839f1b9c7f2f370 /libqmenumodel | |
parent | 24cc4eefb93849302985559958c5392c9ea81552 (diff) | |
parent | 0defce2e357d171ff7400555779210eb9a9788be (diff) | |
download | qmenumodel-08289ff0e7457d75682390fc8e926f11f2386045.tar.gz qmenumodel-08289ff0e7457d75682390fc8e926f11f2386045.tar.bz2 qmenumodel-08289ff0e7457d75682390fc8e926f11f2386045.zip |
Merge branch 'personal/peat-psuwit/uint16'
Attributes GH PR #25: https://github.com/AyatanaIndicators/qmenumodel/pull/25
Diffstat (limited to 'libqmenumodel')
-rw-r--r-- | libqmenumodel/src/ayatanamenumodel.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/libqmenumodel/src/ayatanamenumodel.cpp b/libqmenumodel/src/ayatanamenumodel.cpp index 39ce0bc..9ab0ff4 100644 --- a/libqmenumodel/src/ayatanamenumodel.cpp +++ b/libqmenumodel/src/ayatanamenumodel.cpp @@ -584,7 +584,12 @@ static QVariant attributeToQVariant(GVariant *value, const QString &type) { QVariant result; - if (type == "int") { + if (type == "int16") { + if (g_variant_is_of_type (value, G_VARIANT_TYPE_INT16)) { + result = QVariant(g_variant_get_int16(value)); + } + } + else if (type == "int32" || type == "int") { if (g_variant_is_of_type (value, G_VARIANT_TYPE_INT32)) { result = QVariant(g_variant_get_int32(value)); } @@ -594,6 +599,21 @@ static QVariant attributeToQVariant(GVariant *value, const QString &type) result = QVariant((qlonglong)g_variant_get_int64(value)); } } + else if (type == "uint16") { + if (g_variant_is_of_type (value, G_VARIANT_TYPE_UINT16)) { + result = QVariant(g_variant_get_uint16(value)); + } + } + else if (type == "uint32") { + if (g_variant_is_of_type (value, G_VARIANT_TYPE_UINT32)) { + result = QVariant(g_variant_get_uint32(value)); + } + } + else if (type == "uint64") { + if (g_variant_is_of_type (value, G_VARIANT_TYPE_UINT64)) { + result = QVariant((quint64)g_variant_get_uint64(value)); + } + } else if (type == "bool") { if (g_variant_is_of_type (value, G_VARIANT_TYPE_BOOLEAN)) { result = QVariant(g_variant_get_boolean(value)); |