[PyQt] qsqltablemodel - ordering results

Tom Proctor tmp at dneg.com
Thu Sep 2 17:08:36 BST 2010


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,
Tom


More information about the PyQt mailing list