[Qt-interest] QSqlRelationalTableModel - Sort on multiple column

Tony Rietwyk tony.rietwyk at rightsoft.com.au
Mon Jun 22 01:51:47 CEST 2009


Jean-Pierre wrote: 

Hi, 


I'm trying to sort my QSqlRelationalTableModel on multiple column but it
doesn't seem to work. There is a setSort method but it only allows to sort
on one column, the given column.


ex: setSort( 1, Qt::AscendingOrder );


If I call two time setSort, it doesn't stack them, it considers only the
last call.


Is there a way to sort like this : ORDER BY column1, column2


Thanks.


Hi Jean-Pierre, 
 
Try subclassing and overriding orderByClause from QSqlTableModel. 
 
Regards, 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090622/168484f0/attachment.html 


More information about the Qt-interest-old mailing list