On 01/16/2017 09:07 PM, mark diener wrote:
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();


You should always use functions of that sort to notify
views of changes to the underlying model. From my experience
this becomes even more important if you start to use proxy models.

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.croc...@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@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest



_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to