[Qt-interest] sorting on more than one "column"

Mihail Naydenov mlists at ymail.com
Tue Nov 3 16:51:06 CET 2009


Does Qt support sorting on more then one field at a time? 
(Like, in some view, clicking on a header will sort, 'shift'-clicking once more on diff column, it will further sort the results)

If not in views, is it supported in some model

        tbl->setSort(tbl->fieldIndex("country"), Qt::AscendingOrder);
        tbl->setSort(tbl->fieldIndex("location"), Qt::DescendingOrder);
        tbl->select();

I had hoped this will sort first based on country, then further sort the cities in this countries.
But no, the second sort overrides the first :)

I imagine the only way to do this is using QSqlQuery directly. Is this correct? 
(except, manually sorting the results afterwards, of course)

Thank You
MihailNaydenov



      



More information about the Qt-interest-old mailing list