Hi, any tips on what should i be using to sort a sql table when user click in headers? Thanks!
Regrds, Miguel Ángel. El 01/05/12 07:13, Bo Thorsen escribió: > Hi, > > My advice is to ditch QSortFilterProxyModel completely. It's great for > models that can be held in memory. But for SQL models, it sucks. > > Bo. > > Den 30-04-2012 19:02, Linos skrev: >> 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. >> _______________________________________________ >> Interest mailing list >> Interest@qt-project.org >> http://lists.qt-project.org/mailman/listinfo/interest > > > Bo Thorsen, > Fionia Software. > _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest