aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Tari <robert@tari.in>2023-07-12 02:29:31 +0200
committerRobert Tari <robert@tari.in>2023-07-12 02:29:31 +0200
commit08289ff0e7457d75682390fc8e926f11f2386045 (patch)
tree277ace6cc89d03650e368ce15839f1b9c7f2f370
parent24cc4eefb93849302985559958c5392c9ea81552 (diff)
parent0defce2e357d171ff7400555779210eb9a9788be (diff)
downloadqmenumodel-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
-rw-r--r--libqmenumodel/src/ayatanamenumodel.cpp22
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));