title: Behavior of selectionChanged() on removing first row
body: <p>Please run the following code (I am using Qt 5.9):</p>
  
  <pre><code>QTableWidget* tableWidget = new QTableWidget(2, 2, nullptr);
  tableWidget-&gt;setSelectionBehavior(QAbstractItemView::SelectRows);
  tableWidget-&gt;setSelectionMode(QAbstractItemView::SingleSelection);
  connect(tableWidget-&gt;selectionModel(), &amp;QItemSelectionModel::selectionChanged,
     [&amp;](const QItemSelection&amp; selected, const QItemSelection&amp; deselected) 
     { qDebug() &lt;&lt; "selected =" &lt;&lt; selected &lt;&lt; endl &lt;&lt; "deselected =" &lt;&lt; deselected; });
  tableWidget-&gt;show();
  QTimer::singleShot(10000, [=](){ tableWidget-&gt;removeRow(0); });
  </code></pre>
  
  <p>Within 10 seconds, select the first of two rows. You will see debug ouput. It will show you that row 0 was selected by your click.
  Then, after 10s, row 0 is removed automatically. Debug output now shows that row 1 is selected and row 0 is deselected.</p>
  
  <p>The latter doesn't make any sense to me. When removing row 0 I would expect the "new" row 0 being selected afterwards. Also the visually selected row still is row 0 and row 1 simply doesn't exist anymore.</p>
  
  <p>This also happens with a custom model and generic view and makes my application crash by pointing to a row that does not exist.</p>
  
  <p>Is this desired behavior? Where is my misunderstanding?</p>