[Interest] QSortFilterProxyModel slow updating sql model attached
Linos
info at linos.es
Mon Apr 30 19:02:07 CEST 2012
Hi,
i have a QTableView with a QSortFilterProxyModel using a QSqlQueryModel as
source model, i am using Qt 4.8.1 in Linux x86_64.
if i don't apply sort to any of the columns of the table and execute a new
.select() on the QSqlQueryModel it does the usual and only call .data method for
the visible rows after the new data has been populated but if i have the table
sorted by any column the data method gets called 56000 times for a 1000 row
table ever using indexes of the sorted col, i can understand that it is sorting
at the same it is creating indexes and data.
The problem it is i can't get it to ignore sorting to do manually after the new
data is populated in the model. i have tried this:
1) call table.setSortingEnabled(False) (with proxyModel.setDynamicSortFilter()
using true and false)
2) call proxyModel.invalidate() before model.select()
3) call proxyModel.reset() before model.select()
I can't think other way to make this right now, i could set a fake model as
source for the proxymodel before call select in model and set the original model
after that but it seems awkward to me, should be a better way, so any help
please? :)
Regards,
Miguel Angel.
More information about the Interest
mailing list