PDA

View Full Version : QTableView Issues with Qt 4.5.3



tntcoda
5th October 2009, 20:58
Hi,

My program has been working perfectly with all versions of Qt up to 4.5.2, however with Qt 4.5.3 I have big problems with rows updating in my QTableView.

I'm really stuck because the code has been working fine for so long, I cant narrow down what the problem is :(

For example here is my model's data function, column 3 updates randomly, not when the models data actually changes, for example if i click around and resize the tableview it forces the value to update.



QVariant dlQueueModel::data(const QModelIndex &index, int role) const
{
// Data for table view
if(!index.isValid())
{
return QVariant();
}

if(index.row() >= jobs.size() || index.row() < 0)
{
return QVariant();
}

if (role == Qt::DisplayRole)
{

...

else if(index.column() == 4)
{
return QString::number(jobs.at(index.row()).getTotalSegme nts() - jobs.at(index.row()).getIncompleteSegments()) +
" of " + QString::number(jobs.at(index.row()).getTotalSegme nts());
}
}


return QVariant();
}


When I update the data I call this function:


void dlQueueModel::itemChanged(int aX, int aY, int bX, int bY)
{
// Let the model know its data has changed
emit dataChanged(createIndex(aX, aY), createIndex(bX, bY));
}


Does anyone know of anything QTableView related that changed in 4.5.3 that could be causing these issues?

Thanks and sorry for the vagueness!