title: Building a QHash with QStringList in C++
body: <p>In C++ I am trying to build a specialized QHash like this:</p>
  
  <pre><code>QHash&lt;QString, QStringList&gt; myhash;
  </code></pre>
  
  <p>Such that I can store this type of data:</p>
  
  <pre><code>QHash key    QStringList values
  ----------   ------------------
  A            1
               2
               3
  B            5
               6
  </code></pre>
  
  <p>I am having trouble with the C++ syntax to properly build the hash and how to retrieve the hash values.  For example, if given B, the I wish to loop and return 5,6.</p>
  
  <p>Here is my hacked attempt at the logic to append to the hash when a new key,value pair is to be added:</p>
  
  <pre><code>QHash&lt;QString, QStringList&gt; myhash;
  
  key = "A";
  value = "2";
  
  if (myhash.contains(key) ) {
      QStringList mylist = myhash.value(key);    
      mylist.append(value);    
  } else {
      QStringList mylist;
      mylist.append(value);
      myhash.insert( key, mylist);
  }
  </code></pre>
  
  <p>I'm unsure if this works, since I haven't been able to create the retrieve looping logic for the myhash.</p>
  
  <p>Can anyone help me build and retrieve the data from such a QHash?</p>