Sorting QList : QList « Qt « C++






Sorting QList

  

#include <QList>
#include <QDebug>

int main()
{
  QList<int> values;
  values << 1 << 10 << 5 << 6 << 7 << 3;
  qSort(values);
  qDebug() << values; // output: ( 1, 3, 5, 6, 7, 10 )
  return 0;
}

   
    
  








Related examples in the same category

1.Add int to QList
2.Append and insert into QList
3.Foreach loop with QList
4.Find next element in a QList with QMutableListIterator
5.QList of QString
6.Delete all elements in a QList
7.Filling Data Structures
8.Quick sort QList
9.QList of int