inktomi
15th July 2009, 17:22
I subclassed QAbstractTableModel and implemented rowCount(), columnCount() and data(). The actual data is stored in a QList outside the model and the model has a pointer to the QList. Data manipulation of the QList occurs outside the model (I'm not using setData).
In order to update the view, I implemented a method in the model that emits the dataChanged signal. The problem is that the view is not being updated.
void ClipListTableModel::updateViews(QModelIndex start, QModelIndex end)
{
emit dataChanged(start, end);
}
The start and end values are retrieved as follows. The table has 5 rows, hence the 4 in the argument.
QModelIndex in1 = clipListModel->index(row, 0, QModelIndex());
QModelIndex in2 = clipListModel->index(row, 4, QModelIndex());
clipListModel->updateViews( in1, in2 );
To make sure that the model is working correctly, I used setModel() each time I wanted an update. Everything worked fine this way.
In order to update the view, I implemented a method in the model that emits the dataChanged signal. The problem is that the view is not being updated.
void ClipListTableModel::updateViews(QModelIndex start, QModelIndex end)
{
emit dataChanged(start, end);
}
The start and end values are retrieved as follows. The table has 5 rows, hence the 4 in the argument.
QModelIndex in1 = clipListModel->index(row, 0, QModelIndex());
QModelIndex in2 = clipListModel->index(row, 4, QModelIndex());
clipListModel->updateViews( in1, in2 );
To make sure that the model is working correctly, I used setModel() each time I wanted an update. Everything worked fine this way.