[Solved] Ordering Problem with QMap
-
Hi guys.
I have ordering problem with QMap. I've googled it but my problem didn't solved.
Suppose I have QMap<QString,int>. After i insert some values into QMap the ordering is not kept. I didn't find any substitution option.
Is there any (key, value) pairs container class int Qt that keep the ordering of keys. -
Hi,
The items are always sorted by key, while iterating over a QMap. "read documentation":http://qt-project.org/doc/qt-5.0/qtcore/qmap.html#details
You can have a look at "this":http://qt-project.org/forums/viewthread/19394 thread for the required implementation.
-
Thanks :) I used QList<QPair<T1,T2> > and that's ok :)