@JonB said in TableView not updated or refreshed unless column is resized and scroll bar move up and down few times:
@VikramSamy
I don't know, but a couple of observations:
You are using a QSqlTableModel, so it should be emitting all the dataChanged() and rowsInnserted() signals itself. I would remove all your emits.
YES REMOVED
HistoryProxyModel->setDynamicSortFilter(false);: try setting this to true, any difference?
NO, I need to disable the-sorting mechanism in the proxy model and do the sorting in the SQL Table model itself before I initialize table-model as the source-model for the Qsortproxymodel
If you remove your proxy model temporarily does everything work?
Ya the the VIEW is updated properly if proxy model is removed.
Try starting from a Qt example with model + proxy model, does that work? YES I DID
After a long gap, i just started to check this issue again,
the previous behavior of the Table View was due to the flow of my code and it is because descending order SORTING mechanism enabled in the proxy-model, this caused the behavior as in 1st post. T
//this was the issue
HistoryProxyModel->setDynamicSortFilter(true); HistoryProxyModel->sort(1,Qt::DescendingOrder);
As I wanted to show the last row as first row in the Table View, I enabled the DescendingOrder sorting in the proxy model first and then apply filtering, and this was the issue .
but then I enabled the descending Order sorting on the SQL Table Model and Disabled it on the proxy model,
now all works fine, The proxy model just do the filtering's only. i added the code below on my Qsql Table Model.
//this was the solution - sort the Table model
TableModel->setSort(1,Qt::DescendingOrder);
and so i removed the sorting codes at the proxy model .
I removed the below code:-
//removed from proxy codes
//HistoryProxyModel->sort(1,Qt::DescendingOrder)
and now so far all works fine....