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

Mihail Naydenov mlists at ymail.com
Wed Nov 4 17:46:07 CET 2009


Hi, I just noticed there is already a suggestion on the bugtracker.

...but we will have to wait for 5.0 :)

BTW, after a couple of hours researching, it seam there is now easy way to do this, not to mention one will have to write both new model and a new view for it. 
For now the easiest is to use QSqlQuery directly and manually handle the data...

Anyway, Thank You Qt team for implementing this!
MihailNaydenov


----- Original Message ----
> From: "Malyushytsky, Alex" <alex at wai.com>
> To: "qt-interest at trolltech.com" <qt-interest at trolltech.com>
> Sent: Wed, November 4, 2009 12:42:54 AM
> Subject: Re: [Qt-interest] sorting on more than one "column"
> 
> 
> There is no ready standard support for complex sorting, but check the following
> http://doc.trolltech.com/4.1/qsortfilterproxymodel.html
> 
> 
> Regards,
>     Alex
> 
> -----Original Message-----
> From: qt-interest-bounces at trolltech.com 
> [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Mihail Naydenov
> Sent: Tuesday, November 03, 2009 7:51 AM
> To: qt-interest at trolltech.com
> Subject: [Qt-interest] sorting on more than one "column"
> 
> 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
> 
> 
> 
> 
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
> 
> 
> ---------------------------------------------------------------------------------------------------
> Weidlinger Associates, Inc. made the following annotations.
> 
> "This message and any attachments are solely for the intended recipient and may 
> contain confidential or privileged information. If you are not the intended 
> recipient, any disclosure, copying, use, or distribution of the information 
> included in this message and any attachments is prohibited. If you have received 
> this communication in error, please notify us by reply e-mail and immediately 
> and permanently delete this message and any attachments. Thank you."
> 
> "Please consider our environment before printing this email."
> 
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest



      



More information about the Qt-interest-old mailing list