[SailfishDevel] Persistently storing a ListModel

Andrey Kozhevnikov coderusinbox at gmail.com
Fri Nov 4 19:07:33 UTC 2016


pointer is an address to memory, its pontless to save, you should save 
data.
dconf can be accessed using MGconfItem from mlite5 library.

------ Исходное сообщение ------
От: "Marcin Mielniczuk" <marmistrzmar at gmail.com>
Кому: "Andrey Kozhevnikov" <coderusinbox at gmail.com>; "Sailfish OS 
Developers" <devel at lists.sailfishos.org>
Отправлено: 04.11.2016 22:00:19
Тема: Re: [SailfishDevel] Persistently storing a ListModel

>Thanks a lot!
>
>So I'm trying to store a pointer to ListModel and ConfigurationValue
>drops this silently because it's an invalid value, doesn't it?
>
>What is the standard way in Sailfish to access DConf from C++? I think
>about reimplementing the model as a subclass of QAbstractListModel 
>anyway.
>
>Marcin
>
>On 01.11.2016 20:46, Andrey Kozhevnikov wrote:
>>  you storing pointer to model, not model contents :)
>>  to store model data you should recursively convert model data to
>>  array, and vise versa.
>>
>>  ------ Исходное сообщение ------
>>  От: "Marcin Mielniczuk" <marmistrzmar at gmail.com>
>>  Кому: "Sailfish OS Developers" <devel at lists.sailfishos.org>
>>  Отправлено: 01.11.2016 22:32:57
>>  Тема: [SailfishDevel] Persistently storing a ListModel
>>
>>>  Hi,
>>>
>>>  I'm currently using org.nemomobile.configuration to store the
>>>  application settings. Now it came out it'd be beneficial to store a
>>>  ListModel between runs (if a user wants it).
>>>
>>>  I tried the naive approach:
>>>
>>>      property ListModel myModel: modelStorage.value
>>>
>>>      ConfigurationValue {
>>>          id: modelStorage
>>>          key: Constants.modelStorageKey
>>>          defaultValue: ListModel {}
>>>      }
>>>
>>>  But no dconf key seems to be generated after I populate the model.
>>>
>>>  What is my best bet in this case? Is this the expected behavior or 
>>>have
>>>  I done something wrong on my side?
>>>
>>>  --
>>>  Marcin
>>>
>>>
>>>  _______________________________________________
>>>  SailfishOS.org Devel mailing list
>>>  To unsubscribe, please send a mail to
>>>  devel-unsubscribe at lists.sailfishos.org
>>
>>  _______________________________________________
>>  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