[Interest] 5.8.0 QAbstractListModel

mark diener rpzrpzrpz at gmail.com
Tue Jan 17 03:07:55 CET 2017


Bill:

I thought I would do a brain dump on what I learned.

If your data is bound by the roleNames() mechanism, then the
dataChanged( ) function works greatl

If your data is retrieved by INVOKABLE functions, then you need to call
the following:

QModelIndex gi = QModelIndex() ;
beginInsertRows(gi,gnrow,gnrow);
endInsertRows();
beginRemoveRows(gi,gnrow,gnrow);
endRemoveRows();

This will force the listview to drop and re-create the component in
the delegate.

Thanks for your feedback.

Marco



On Mon, Jan 16, 2017 at 12:05 PM, Bill Crocker
<william.crocker at analog.com> wrote:
>
>>>
>>> I do this all of the time and it works fine.
>>>
>>>      QModelIndex index = createIndex(row,col);
>>>      emit dataChanged(index,index);
>>>
>
>> Have you tried it under 5.8.0RC?
>> It was working under 5.7.1 and before.
>> What value for column are you using?
>> For AbstractListModel, I was using 0 (zero)
>
>
> I am at 5.7
> Yes, for a List model, col would always be 0.
> Per a previous post, are you adding or removing rows.
> If so, was that all reported (emitted) so the views know about it.
> Models are a pain in the butt in that if you do not
> use them correctly, they will silently misbehave
> and not necessarily right away.
>
> You should also use the "ModelTest" class to
> point out the mistakes that it can.
>
> Bill
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest



More information about the Interest mailing list