C++/Qt4: QTableView with QSortFilterProxyModel as model doesn't update values
	
	
		Hi, I have a QTableView with a QSortFilterProxyModel as it's model. Source model for the proxy is a custom model subclassing QAbstractTableModel. I update the source model every minute. I made a function for that thats get called every minute:
	Code:
	
void CustomModel::update()
{
    for(int i = 0; i < alarms.size(); i++)
        alarms[i]->addMinute();
 
    timer
->start
((60 - QTime::currentTime().
second()) *1000);
 
    emit dataChanged(index(0, 0), index(alarms.size(), 3));
}
 
The problem is that the proxy model doesn't update it's values, except if i repaint the window (by minimizing and maximizing the window), or click a table header. Also i want it sorted, and does that a couple of times, but later it stops. Here is the code i use on my main window:
	Code:
	
proxyModel->setSourceModel(&CustomModelInstance);
    proxyModel->setDynamicSortFilter(true);
    proxyModel->sort(2, Qt::DescendingOrder);
 
I thought that by calling dataChanged() when updating values on the source model every proxy model should also update itself. What im doing wrong?
	 
	
	
	
		Re: C++/Qt4: QTableView with QSortFilterProxyModel as model doesn't update values
	
	
		I don't see any problem aside from your end index being wrong.
Row value is one off, maybe the column value as well (does the model have 4 columns?)
Cheers,
_
	 
	
	
	
		Re: C++/Qt4: QTableView with QSortFilterProxyModel as model doesn't update values
	
	
		the end index values were off by one, the model has 3 columns. Now everything is working fine!, thanks!