[SailfishDevel] Sharing model between pages ("by reference")

Krisztian Olah fasza2mobile at gmail.com
Sun Feb 1 12:48:20 UTC 2015


Hi Dirk, perhaps what you really want to do is filter the data through 1or 2 proxy models, that way you get 2 different models whilst still using the same source model. When data changes in the source it notifies the proxies as well of the change and both views update.

Otherwise, if it is not what you want to do, but to use the exact same model in both views, just make sure that you pass the exact same address to QML. 

Regards 
Kris 

On Sun Feb 1 10:44:49 2015 GMT, Dirk Zimmermann wrote:
> On 01.02.2015 11:19, Andrey Kozhevnikov wrote:
> > Why didn't you tried before asking? This is working in exactly same way
> > as you described in your question.
> 
> I asked because in my case it didn't work. Otherwise there wouldn't have
> been a reason to ask :)
> 
> > Below is template pages. MainPage declares testModel, FirstPage and
> > SecondPage using same model as reference, assigned to listModel
> > property. Everything works flawlessly.
> 
> Thanks for the feedback, there must be something else in my code that
> lets the two models deviate (as in not referencing the same object anymore).
> 
> Dirk
> _______________________________________________
> 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