<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Sorting QList&lt;QMap&lt;QString , qreal &gt; &gt;]]></title><description><![CDATA[<p dir="auto">Hi<br />
I have a container in this form :  QList&lt;QMap&lt;QString , qreal &gt; &gt;  myContainer .<br />
How can I sort this QList according to qreal ?</p>
]]></description><link>https://forum.qt.io/topic/5605/sorting-qlist-qmap-qstring-qreal</link><generator>RSS for Node</generator><lastBuildDate>Thu, 14 May 2026 12:40:55 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/5605.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 07 May 2011 11:21:13 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Sorting QList&lt;QMap&lt;QString , qreal &gt; &gt; on Sat, 07 May 2011 18:18:12 GMT]]></title><description><![CDATA[<p dir="auto">[quote author="leon.anavi" date="1304773869"]<br />
Hi Gerolf,<br />
I have no idea what is the exact goal as the combination of QMap and QList is a bit strange for sorting :)</p>
<p dir="auto">@<br />
void qSort ( RandomAccessIterator begin, RandomAccessIterator end, LessThan lessThan )<br />
@</p>
<p dir="auto">Can't he use custom lessThan method which compares QMap&lt;QString , qreal &gt; in a desired way (whatever it is) and fits his needs?<br />
<em>amiref</em>, please provide more details as suggested by <em>Zlatomir</em><br />
[/quote]</p>
<p dir="auto">Yes, he can, that's right. But I'm looking for the logic on sorting a list of qmaps....</p>
]]></description><link>https://forum.qt.io/post/86893</link><guid isPermaLink="true">https://forum.qt.io/post/86893</guid><dc:creator><![CDATA[giesbert]]></dc:creator><pubDate>Sat, 07 May 2011 18:18:12 GMT</pubDate></item><item><title><![CDATA[Reply to Sorting QList&lt;QMap&lt;QString , qreal &gt; &gt; on Sat, 07 May 2011 13:11:09 GMT]]></title><description><![CDATA[<p dir="auto">[quote author="Gerolf" date="1304772427"]<br />
On which base should he sort?</p>
<p dir="auto">he has a</p>
<p dir="auto">@</p>
<p dir="auto">class MyContainer : QMap&lt;QString , qreal&gt;{};</p>
<p dir="auto">QList&lt;MyContainer&gt;;<br />
@</p>
<p dir="auto">To use qSort, MyContainer needs a less then operator.</p>
<p dir="auto">[/quote]</p>
<p dir="auto">Hi Gerolf,</p>
<p dir="auto">I have no idea what is the exact goal as the combination of QMap and QList is a bit strange for sorting :)</p>
<p dir="auto">@<br />
void qSort ( RandomAccessIterator begin, RandomAccessIterator end, LessThan lessThan )<br />
@</p>
<p dir="auto">Can't he use custom lessThan method which compares QMap&lt;QString , qreal &gt; in a desired way (whatever it is) and fits his needs?</p>
<p dir="auto"><em>amiref</em>, please provide more details as suggested by <em>Zlatomir</em></p>
<p dir="auto">Thanks,<br />
Leon</p>
]]></description><link>https://forum.qt.io/post/86868</link><guid isPermaLink="true">https://forum.qt.io/post/86868</guid><dc:creator><![CDATA[leon.anavi]]></dc:creator><pubDate>Sat, 07 May 2011 13:11:09 GMT</pubDate></item><item><title><![CDATA[Reply to Sorting QList&lt;QMap&lt;QString , qreal &gt; &gt; on Sat, 07 May 2011 12:57:27 GMT]]></title><description><![CDATA[<p dir="auto">He can use the "qSort(...)":<a href="http://doc.qt.nokia.com/4.7.1/qtalgorithms.html#qSort-2" target="_blank" rel="noopener noreferrer nofollow ugc">http://doc.qt.nokia.com/4.7.1/qtalgorithms.html#qSort-2</a> overload that takes an less-than function.</p>
<p dir="auto">But i have a feeling that he wants something different - because i can't imagine what criteria he wants to use to sort a vector of maps - this is why i asked more information.</p>
]]></description><link>https://forum.qt.io/post/86867</link><guid isPermaLink="true">https://forum.qt.io/post/86867</guid><dc:creator><![CDATA[Zlatomir]]></dc:creator><pubDate>Sat, 07 May 2011 12:57:27 GMT</pubDate></item><item><title><![CDATA[Reply to Sorting QList&lt;QMap&lt;QString , qreal &gt; &gt; on Sat, 07 May 2011 12:47:07 GMT]]></title><description><![CDATA[<p dir="auto">[quote author="leon.anavi" date="1304771691"]Hi,<br />
Use "qSort":<a href="http://doc.qt.nokia.com/4.7.1/qtalgorithms.html#qSort" target="_blank" rel="noopener noreferrer nofollow ugc">http://doc.qt.nokia.com/4.7.1/qtalgorithms.html#qSort</a> or "qStableSort":<a href="http://doc.qt.nokia.com/4.7.1/qtalgorithms.html#qStableSort" target="_blank" rel="noopener noreferrer nofollow ugc">http://doc.qt.nokia.com/4.7.1/qtalgorithms.html#qStableSort</a> from "Qt Generic Algorithms":<a href="http://doc.qt.nokia.com/qq/qq15-qalgorithms.html" target="_blank" rel="noopener noreferrer nofollow ugc">http://doc.qt.nokia.com/qq/qq15-qalgorithms.html</a><br />
Best regards,<br />
Leon[/quote]</p>
<p dir="auto">On which base should he sort?</p>
<p dir="auto">he has a</p>
<p dir="auto">@</p>
<p dir="auto">class MyContainer : QMap&lt;QString , qreal&gt;{};</p>
<p dir="auto">QList&lt;MyContainer&gt;;<br />
@</p>
<p dir="auto">To use qSort, MyContainer needs a less then operator.</p>
]]></description><link>https://forum.qt.io/post/86863</link><guid isPermaLink="true">https://forum.qt.io/post/86863</guid><dc:creator><![CDATA[giesbert]]></dc:creator><pubDate>Sat, 07 May 2011 12:47:07 GMT</pubDate></item><item><title><![CDATA[Reply to Sorting QList&lt;QMap&lt;QString , qreal &gt; &gt; on Sat, 07 May 2011 12:34:51 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">Use "qSort":<a href="http://doc.qt.nokia.com/4.7.1/qtalgorithms.html#qSort" target="_blank" rel="noopener noreferrer nofollow ugc">http://doc.qt.nokia.com/4.7.1/qtalgorithms.html#qSort</a> or "qStableSort":<a href="http://doc.qt.nokia.com/4.7.1/qtalgorithms.html#qStableSort" target="_blank" rel="noopener noreferrer nofollow ugc">http://doc.qt.nokia.com/4.7.1/qtalgorithms.html#qStableSort</a> from "Qt Generic Algorithms":<a href="http://doc.qt.nokia.com/qq/qq15-qalgorithms.html" target="_blank" rel="noopener noreferrer nofollow ugc">http://doc.qt.nokia.com/qq/qq15-qalgorithms.html</a></p>
<p dir="auto">Best regards,<br />
Leon</p>
]]></description><link>https://forum.qt.io/post/86861</link><guid isPermaLink="true">https://forum.qt.io/post/86861</guid><dc:creator><![CDATA[leon.anavi]]></dc:creator><pubDate>Sat, 07 May 2011 12:34:51 GMT</pubDate></item><item><title><![CDATA[Reply to Sorting QList&lt;QMap&lt;QString , qreal &gt; &gt; on Sat, 07 May 2011 11:46:33 GMT]]></title><description><![CDATA[<p dir="auto">Which qreal? Since each QMap (form the QList) can have many qreal values? Tell us what are you trying to do so that we can give some advice about that.</p>
]]></description><link>https://forum.qt.io/post/86855</link><guid isPermaLink="true">https://forum.qt.io/post/86855</guid><dc:creator><![CDATA[Zlatomir]]></dc:creator><pubDate>Sat, 07 May 2011 11:46:33 GMT</pubDate></item></channel></rss>