[PyQt] qsqltablemodel - ordering results
dankripac at gmail.com
Thu Sep 2 22:22:18 BST 2010
Hey Tom (hey - don't I work with you? ;-),
Have you tried looking at making a
or even better a
putting it between your QSqlTableModel and your QTableView?
You can override the MapFromSource and MapToSource methods and perhaps do
your column swapping in there? Or maybe you could do it all in the sort
On 2 September 2010 17:08, Tom Proctor <tmp at dneg.com> wrote:
> I would like to use a subclassed QSqlTableModel to fill a QTableView, but
> I'd like the order of the columns in the table to be different from the
> order of my fields in the database.
> I thought there must be some way to modify the query in .select() but I
> haven't gotten that to work. Using setQuery only seems to prevent queries
> from returning values.
> I also tried simply changing horizontalHeader().moveSection() on the table,
> but this is ugly as it needs to be reset each time I filter or select again.
> Any ideas?
> Thank you,
> PyQt mailing list PyQt at riverbankcomputing.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the PyQt