[Development] Is QMap Broken

Tomasz Siekierda sierdzio at gmail.com
Thu Nov 6 09:10:18 CET 2014


> On 06/11/2014 01:36, Robert Steckroth wrote:
>
> Consider the following program, shouldn't the end() iterator place each key
> at the end of the newly created QMap. Instead, the keys and subsequent
> iterations are sorted (somehow).

Neither QMap nor QHash preserve the order of item insertion. If you
need that, use QList/QVector etc. To store 2 items at a single
position in list/ vector, you can use QPair, like this:
  QLIst<QPair<type1, type2> >()



More information about the Development mailing list