title: How to print a vector in plain text in QT
body: <pre><code> int b=0;
       QVector&lt;int&gt; z(5);
       for(int i=0;i&lt;5;i++)
       z.push_back(i);
       for(int i=0;i&lt;z.size();i++)
       {
           b=z.at(i);
           QString str=QString::number(b);
  
               ui-&gt;mbox-&gt;setText(str);
  
       }
  </code></pre>
  
  <p>I wrote this code to print a vector in plain text but it just print first row I want to print 
  whole vector
  not:mbox is a plain textedit</p>
  
  <p>now there is another problem</p>
  
  <pre><code>QVector&lt;int&gt; z(5);
       for(int i=0;i&lt;5;i++)
       z.push_back(i);
           QString str;
           for (int i = 0; i &lt; z.size(); ++i)
           {
               if (i &gt; 0)
                   str += " ";
               str += QString::number(z[i]);
           }
  
           ui-&gt;mbox-&gt;setText(str);
   }  
  </code></pre>
  
  <p>in first for loop when I wrote z.size() I get Qt has caught an exception thrown from an event handler. Throwing
  exceptions from an event handler is not supported in Qt. You must
  reimplement QApplication::notify() and catch all exceptions there.</p>
  
  <p>and also in second for when I wrote z.size I get 10 output but size of z is 5 as you can see .what is wrog
  first 5 output is 0 and then rest is normal like 0 1 2 3 4
  but I should have 5 output am I wrong </p>