<?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[How to insert hash value from a QStringList using a for loop (solved)]]></title><description><![CDATA[<p dir="auto">error:<br />
error: no match for 'operator[]' in StationHash.QHash &lt;k,v)::value<br />
@<br />
QStringList StationList<br />
QHash&lt;int, QString&gt; stationHash;</p>
<p dir="auto">QHash&lt;int, QString&gt; ::iterator i;<br />
for(i=StationHash.begin(); i !=StationHash.end(); ++i)<br />
{<br />
StationHash.value[i]= StationList[i];<br />
}</p>
<p dir="auto">@</p>
]]></description><link>https://forum.qt.io/topic/49264/how-to-insert-hash-value-from-a-qstringlist-using-a-for-loop-solved</link><generator>RSS for Node</generator><lastBuildDate>Sun, 15 Mar 2026 19:50:27 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/49264.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 16 Dec 2014 02:29:29 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to insert hash value from a QStringList using a for loop (solved) on Tue, 16 Dec 2014 06:03:16 GMT]]></title><description><![CDATA[<h1>If you are inserting from <em>StationList</em> to <em>stationHash</em> then <em>stationHash</em> is empty and your loop will never be executes.</h1>
<h1><em>i</em> is an iterator. You can not use iterator as an index.</h1>
<h1>Why do you need a string hash that replicates a string list</h1>
<p dir="auto">Anyway, try this<br />
@<br />
for (int i = 0; i &lt; StationList.size(); ++i) {<br />
stationHash.insert(i, StationList[i])<br />
}<br />
@</p>
]]></description><link>https://forum.qt.io/post/254439</link><guid isPermaLink="true">https://forum.qt.io/post/254439</guid><dc:creator><![CDATA[andreyc]]></dc:creator><pubDate>Tue, 16 Dec 2014 06:03:16 GMT</pubDate></item></channel></rss>