You all know QSqlQueryModel doesn't support neither sorting nor filtering.
I need this functionality.
I've been doing sorting and filtering with a QSortFilterProxyModel attached to my QSqlQueryModel, but that's highly unefficient since it does the sorting locally, and has to fetch the full query data to do it. When you have Query results with more than 20.000 rows, from a remote database (connection lag counts), it will freeze the GUI and take a lot of time to process. So this option is no longer available to me.
It seems logical to have a QSqlQueryModel subclass that allows sorting and filtering remotely by using query language ("ORDER BY", "WHERE" clauses), and taking advantage of the QSqlQueryModel's lazy loading (fetchMore).
It seems almost too logical, so I wonder if anyone has already done something like this.. ¿?
Note: Can't use QSqlTableModel nor QSqlRelationalTableModel because of the query complexity. Here is an example:
SELECT c.id, c.name, co.name AS country, st.name AS state, ci.name AS city, ci.postal_code AS postal_code,
c.address, c.phone, c.fax, c.email, c.cuit, u1.username AS created_by, FROM_UNIXTIME(c.created_time) AS created_time,
u2.username AS modified_by, FROM_UNIXTIME(c.modified_time) AS modified_time
FROM customer AS c
LEFT JOIN geo_city AS ci ON (c.city_id = ci.id)
LEFT JOIN geo_state AS st ON (ci.state_id = st.id)
LEFT JOIN geo_country AS co ON (st.country_id = co.id)
LEFT JOIN user AS u1 ON (c.created_by = u1.id)
LEFT JOIN user AS u2 ON (c.modified_by = u2.id)