title: How to delete all rows from QTableWidget
body: <p>I am trying to delete all rows from a <a href="http://doc.qt.io/qt-4.8/qtablewidget.html">QTableWidget</a> . Here is what I tried.</p>
  
  <pre><code>for ( int i = 0; i &lt; mTestTable-&gt;rowCount(); ++i )
  {
      mTestTable-&gt;removeRow(i);
  }
  </code></pre>
  
  <p>I had two rows in my table. But this just deleted a single row. A reason could be that I did not create the the table with a fixed table size. The Qt Documentation for <a href="http://doc.qt.io/qt-4.8/qtablewidget.html#rowCount-prop">rowCount()</a> says,</p>
  
  <blockquote>
    <p>This property holds the number of rows in the table.</p>
    
    <p>By default, for a table constructed without row and column counts,
    this property contains a value of 0.</p>
  </blockquote>
  
  <p>So if that is the case, what is the best way to remove all rows from table?</p>