title: How can i iterate through QListWidget items and work with each item?
body: <p>In CSharp its as simple as writting :</p>
  
  <pre><code>listBox1.Items.Add("Hello");
  listBox1.Items.Add("There");
  
  foreach (string item in listBox1.Items )
  {
      MessageBox.Show(item.ToString());
  }
  </code></pre>
  
  <p>and I can easily add different objects to a list box and then retrieve them using foreach. 
  I tried the same approach in Qt 4.8.2 but it seems they are different. Though they look very similar at the first. I found that Qt supports foreach so I went on and tried
  something like :</p>
  
  <pre><code>foreach(QListWidgetItem&amp; item,ui-&gt;listWidget-&gt;items())
  {
      item.setTextColor(QColor::blue());
  }
  </code></pre>
  
  <p>which failed clearly. It says the items() needs a parameter which confuses me. I am trying to iterate through the ListBox itself, so what does this mean?
  I tried passing the ListBox object as the parameter itself this again failed too:</p>
  
  <pre><code>foreach(QListWidgetItem&amp; item,ui-&gt;listWidget-&gt;items(ui-&gt;listWidget))
  {
      item.setTextColor(QColor::blue());
  }
  </code></pre>
  
  <p>So here are my questions:</p>
  
  <ul>
  <li>How can I iterate through a QListWidget items in Qt?</li>
  <li>Can I store objects as items in QListWidgets like C#?</li>
  <li>How can I convert an object in QListWidgets to string(C#s ToString counter part in Qt) ?</li>
  </ul>
  
  <p>(Suppose I want to use a QMessagBox instead of that setTextColor and want to print out all string items in the QlistWidget.)</p>