Sort array
-
wrote on 4 Mar 2013, 21:01 last edited by
Hi folks,
Any idea of what to do to sort an array writen like this:
@
QList< QList<QVariant> >
@I want to choose a column to sort and the other QLists must have it´s order modified according with that one.
Thanks
-
wrote on 6 Mar 2013, 12:44 last edited by
Well there are several ways to do that:
- Create your own function based on some "sorting algotythms":http://en.wikipedia.org/wiki/Sorting_algorithm;
- Create some sheild class for using with qSort;
- If you need display result data in some view you can create some custom model which contains your data and bind it with "QSortFilterProxyModel":http://qt-project.org/doc/qt-4.8/qsortfilterproxymodel.html
-
wrote on 6 Mar 2013, 13:45 last edited by
[quote author="qxoz" date="1362573895"]Well there are several ways to do that:
- Create your own function based on some "sorting algotythms":http://en.wikipedia.org/wiki/Sorting_algorithm;
- Create some sheild class for using with qSort;
[/quote]
Hi qxoz. Thanks for your help!
I'm wondering if you could help me to realize how to link all columns.
I know I could use qSort to sort one QList, but how could I link that to the other ones?
-
wrote on 6 Mar 2013, 18:37 last edited by
May be this can help:
"stackoverflow.com":http://stackoverflow.com/questions/5103682/how-to-sort-qlistmyclass-using-qt-library-maybe-qsort
but i didn't try that.
1/4