[SailfishDevel] ConfigurationGroup store array
Michael Fuchs
michfu at gmx.at
Wed Nov 15 14:55:55 UTC 2017
Found a solution:
ConfigurationValue {
id: arrValue
key: "/apps/harbour-test/arr_value"
defaultValue: ["1","2"]
}
....
Button {
text: "Append"
onClicked: {
var list = arrValue.value
list.push("3")
arrValue.value = list
arrValue.sync()
}
}
This works for me. No error message and values are stored and loaded
correctly.
Am 15.11.2017 um 12:46 schrieb Michael Fuchs:
> Hi,
>
> I would like to save an array of strings in my Settings
> (ConfigurationGroup from org.nemomobile.configuration).
>
> How can I achieve this?
>
> This doesnt work:
>
> ConfigurationGroup {
> id: settings
> path: "/apps/harbour-test"
> property var arrString: ["one", "two", "three"]
> }
>
> ...
>
> Button {
> text: "Append"
> onClicked: {
> settings.arrString.push("four")
> settings.arrStringChanged()
> }
>
> This results in an error after settings.arrStringChanged() :
>
> [W] unknown:0 - MDConf: no conversion for "/apps/harbour-test/arrObj"
> QVariant(QJSValue, )
>
>
> greets, Michael.
> _______________________________________________
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to devel-unsubscribe at lists.sailfishos.org
More information about the Devel
mailing list