title: QTableWidget showRow() doesn't work after sorting a table with hidden rows
body: <p>I have a <code>QTableWidget</code> that has X rows.  I have a filtering option that can filter rows by some description.  I hide / show rows accordingly based on the filter.
  If I have a filter active (meaning there are rows that are hidden in the table) and I call <code>sortByColumn()</code>, the table filtering gets messed up.  Hiding and showing no longer work after sorting with hidden rows.
  I am using Qt 5.10.1.
  Here's a brief example:</p>
  <pre><code>QTableWidget* table = new QTableWidget;
  for(int i = 0; i &lt; 5; ++i){
      table-&gt;insertRow(0);
  }
  table-&gt;insertColumn(0);
  
  table-&gt;setItem(0, 0, new QTableWidgetItem(&quot;Blue&quot;));
  table-&gt;setItem(1, 0, new QTableWidgetItem(&quot;Red&quot;));
  table-&gt;setItem(2, 0, new QTableWidgetItem(&quot;Red&quot;));
  table-&gt;setItem(3, 0, new QTableWidgetItem(&quot;Blue&quot;));
  table-&gt;setItem(4, 0, new QTableWidgetItem(&quot;Blue&quot;));
  
  table-&gt;showRow(0);
  table-&gt;hideRow(1);
  table-&gt;hideRow(2);
  table-&gt;showRow(3);
  table-&gt;showRow(4);
  
  //Everythings right to this point, only row 1 and 2 are hidden
  
  table-&gt;sortByColumn(0, Qt::SortOrder::AscendingOrder);
  
  //Everything is still fine, row 1 and 2 are hidden
  
  //Inverting the visibility of rows
  
  table-&gt;hideRow(0);
  table-&gt;showRow(1);
  table-&gt;showRow(2);
  table-&gt;hideRow(3);
  table-&gt;hideRow(4);
  
  //Now I can not get my rows to show again that were hidden before the sort (nothing shows in my table)
  </code></pre>
  <p>Edit: Yes I know the rows wouldn't be in the same place, I have extra logic that checks that in my original code, like if I'm filtering by blue, I iterate over the table and if the entry in the cell is &quot;blue&quot; I'd reverse the show / hide.  But this was just to simplify things (If say the sort by didn't actually move my rows around).</p>
  <p>So the real code for the final bit would be more like:</p>
  <pre><code>for(int i = 0; i &lt; table-&gt;rowCount(); ++i){
     if(table-&gt;item(i, 0)-&gt;text() == &quot;Red&quot;){
        table-&gt;showRow(i);
     }else{
        table-&gt;hideRow(i);
     }
  }
  </code></pre>