[Interest] Qt ListView Christmas Bug

mark diener rpzrpzrpz at gmail.com
Thu Dec 24 20:56:10 CET 2015


Does anybody have a different way to cause a ListView to re-retrieve
the data in the model without causing AbstractListModel destructor
exceptions.

Using  beginResetModel() / endResetModel() in the abstractlistmodel causes
the model destructor to be called with:


testalert(1543,0x7fff72265000) malloc: *** error for object
0x7fff5fbff568: pointer being freed was not allocated

*** set a breakpoint in malloc_error_break to debug

But at no point, either explicity or implicitly do I try to free any models.

Removing calls to beginResetModel() / endResetModel() gets rid of the
exception but then I lose my ability to cause ListView to re-paint
itself with new data. (But no rows added or removed)

There is nothing obvious to call in the docs when you are NOT
inserting or removing rows, but changing the data the of rows already
displayed.

>From the docs:

void QAbstractItemModel::dataChanged(const QModelIndex & topLeft,
const QModelIndex & bottomRight, const QVector<int> & roles =
QVector<int> ())

This signal is emitted whenever the data in an existing item changes.

The abstractitem example does NOT show how to call dataChanged() effectively.

Still looking for example on-line.

Merry Christmas,

md



More information about the Interest mailing list