[Interest] QML ListView is not updated on model reset

Alexander Dyagilev alervdvcw at gmail.com
Mon Feb 27 19:34:17 CET 2017


Ooops... I was wrong... Not the same effect completely.

ListView updates (i.e. new item is added), but all existed items 
damaged: all their model.id properties becomes 0. But the new item's 
model.id property is valid.


On 2/27/2017 9:30 PM, Alexander Dyagilev wrote:
>
> And I use the following code to update it:
>
> voidCorePlaylistsModel::refresh()
>
> {
> autoqstr=QString("SELECT*FROM%1").
> arg(PlaylistsTable::tableName());
> autoquery=m_db->database()->createQuery(qstr);
> verify(query.exec());
> setQuery(query);
> }
>
> I.e. it's not even a reset of the model. But I get the same effect as for another model which I reset in order to update.
>
> On 2/27/2017 9:04 PM, Alexander Dyagilev wrote:
>>
>> I have another ListView wich uses C++ model derived from another 
>> class - QSqlQueryModel.
>>
>> The same things happens: model is not updated and existing items gets 
>> damaged. E.g. model.id for an item was 2 and became 0 after a new 
>> item has been added (all existing item's model.id becomes 0).
>>
>> Something very wrong is happening. Look like I misunderstand something...
>>
>>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20170227/64d74690/attachment.html>


More information about the Interest mailing list