[PyQt] Problems with QSqlQueryModel sort_order

Tony Arnold tony.arnold at manchester.ac.uk
Sat Jan 7 21:29:26 GMT 2017


On Sat, 2017-01-07 at 19:06 +0800, Gerry Brown wrote:
> Greetings,
> I have just started using PyQT and I am having problems with 
> QSqlQueryModel.  It doesn't seem to have an attribute of
> sort_order.  
> How can I have the Postgresql database do the sorting?

You could also try the QSqlTableModel, which inherits QSqlQueryModel
but has an orderByClause method. You may find some other useful
methods in there that might make things simpler.

Tony Arnold MBCS, CITP | Senior IT Security Analyst | Directorate of IT Services | G64, Kilburn Building | The University of Manchester | Manchester M13 9PL | T: +44 161 275 6093 | M: +44 773 330 0039

More information about the PyQt mailing list