Problem QSortFilterProxyModel
Hi,
I have a QSqlQueryModel I do a SELECT on a table with more than 1000 records and apply a QTableView.
When using a QSortFilterProxyModel to sort by fields, only the records that are currently in QTableView are ordered (more or less about 300).
Example, if I have a list of customers from A to Z, by clicking on the "name" to sort in descending order, they order from F to A. It's bug in QT?
Will require reimplementation QSqlQueryModel::sort( ) and back using the SQL ORDER BY clause?
Thank,
Marcelo E. Geyer
Re: Problem QSortFilterProxyModel
No, it's not a bug. It's just Qt doesn't download all the rows from the database for efficiency reasons. You need to call
Code:
while(model->canFetchMore()) model->fetchMore();
to make sure all the rows are retrieved and cached.
Re: Problem QSortFilterProxyModel
So, imagine that. Not to lose this efficiency, the method you suggest reimplemented sort and using SQL ORDER BY? Take into consideration that access can occur through the Internet.
I have other thread open, if you could read I would be very grateful:
http://www.qtcentre.org/forum/f-qt-p...iew-21650.html
Thanks for reply.
Marcelo E. Geyer
Re: Problem QSortFilterProxyModel
Quote:
Originally Posted by
estanisgeyer
So, imagine that. Not to lose this efficiency, the method you suggest reimplemented sort and using SQL ORDER BY? Take into consideration that access can occur through the Internet.
I'm not sure what you mean...