PDA

View Full Version : QListView not updating



Terabyte
6th January 2009, 07:26
Hi, i've created a model, with 2 methods data and rowCount.
When i add data to my model, I call reset(); and then i see (by qDebug) that the overiden methods data() and rowCount() were sucessfully called.

Yet my QListView does not update.
Yes I did view->setModel(model) at the start.

Any help?



QVariant Session::data(const QModelIndex & index, int role) const
{
return QString("lk");
}

janus
6th January 2009, 08:06
Hi,

maybe you need to emit the dataChanged() signal from your setData function?

Terabyte
6th January 2009, 08:10
the solution:

if ((index.isValid()) && (role == Qt::DisplayRole)) return ... else return QVariant


literally.

What a gotcha.