使用 GSettings 时,a{ss} 应该映射到什么 GLib 类型?
What GLib type should a{ss} map to when using GSettings?
我有一个带有 a{ss}
类型键的 gsettings 模式。我想将所述键绑定到对象上的 属性 。我已成功将 g_settings_bind
和 g_settings_bind_with_mapping
与其他键一起使用,但我不知道将此键映射到什么类型。 GVariant
是一个包含键字符串和值字符串的字典数组,但它是什么实际的 glib 类型?
您需要使用 g_settings_bind_with_mapping()
, since a{ss}
is not supported by g_settings_bind()
. a{ss}
is a dictionary mapping strings to strings, and I would probably represent it in GLib as a GHashTable
将字符串映射到字符串。
我有一个带有 a{ss}
类型键的 gsettings 模式。我想将所述键绑定到对象上的 属性 。我已成功将 g_settings_bind
和 g_settings_bind_with_mapping
与其他键一起使用,但我不知道将此键映射到什么类型。 GVariant
是一个包含键字符串和值字符串的字典数组,但它是什么实际的 glib 类型?
您需要使用 g_settings_bind_with_mapping()
, since a{ss}
is not supported by g_settings_bind()
. a{ss}
is a dictionary mapping strings to strings, and I would probably represent it in GLib as a GHashTable
将字符串映射到字符串。