title: QItemSelectionModel::setCurrentIndex doesn't work on opening
body: <p>My code:</p>
  
  <pre><code>void TreeModel::selectIndex(QModelIndex ix) {
    if (!ix.isValid()) return;
    qDebug() &lt;&lt; "name1" &lt;&lt; ix.data();
    tree-&gt;selectionModel()-&gt;clear();
    tree-&gt;setExpanded(ix.parent(), true);
    tree-&gt;selectionModel()-&gt;setCurrentIndex(ix, QItemSelectionModel::SelectCurrent);
    tree-&gt;scrollTo(ix);
  }
  </code></pre>
  
  <p>This snippet runs ok after deleting/inserting nodes. But when I try to select the remembered node from previous session in QMainWindow::showEvent the result is:</p>
  
  <pre><code>name1 QVariant(QString, "Highlight elements") 
  The program has unexpectedly finished.
  C:\Home\develop\qt\arm\designer\Designer exited with code -1073741819
  </code></pre>
  
  <p>without <code>tree-&gt;selectionModel()-&gt;setCurrentIndex(ix, QItemSelectionModel::SelectCurrent);</code> works well, but I do need to select this item.</p>
  
  <p>Thank you very much in advance!</p>
  
  <p>debugger log:</p>
  
  <pre><code>&gt;~"\nProgram received signal "
  &gt;~"SIGSEGV, Segmentation fault.\n"
  &gt;~"0x00438290 in QVariant::Private::Private (this="
  &gt;&amp;"warning: (Internal error: pc 0x0 in read in psymtab, but not in symtab.)\n"
   (Internal error: pc 0x0 in read in psymtab, but not in symtab.)
  &gt;&amp;"\n"
  &gt;~"0x0) at ../../../../../../Qt/Qt5.0.2/5.0.2/mingw47_32/include/QtCore/qvariant.h:367\n"
  &gt;~"367\t        inline Private(): type(Invalid), is_shared(false), is_null(true)\n"
  
  &gt;~"data=[{iname=\"local.node\",name=\"node\",addr=\"0x14384220\",addr=\"0x14384220\",numchild=\"9\",origaddr=\"0x28d86c\",type=\"DNode\",value=\"{...}\",},{iname=\"local.this\",name=\"this\",addr=\"0x14341820\",addr=\"0x14341820\",numchild=\"5\",origaddr=\"0x28d890\",type=\"TreeModel\",value=\"{...}\",},{iname=\"local.index\",name=\"index\",addr=\"0x28dba8\",numchild=\"0\",type=\"QModelIndex &amp;\",value=\"(invalid)\",},{iname=\"local.role\",name=\"role\",addr=\"0x28d898\",numchild=\"0\",type=\"int\",value=\"1\",},],typeinfo=[{name=\"aW50\",size=\"4\"}{name=\"Y29uc3QgUU1vZGVsSW5kZXggJg==\",size=\"4\"}{name=\"RE5vZGUgKg==\",size=\"4\"}{name=\"RE5vZGU=\",size=\"36\"}]\n"
  &gt;2390^done
  dDISCARDING JUNK AT BEGIN OF RESPONSE: 
  dProgram received signal SIGSEGV, Segmentation fault.
  d0x00438290 in QVariant::Private::Private (this=0x0) at ../../../../../../Qt/Qt5.0.2/5.0.2/mingw47_32/include/QtCore/qvariant.h:367
  d367            inline Private(): type(Invalid), is_shared(false), is_null(true)
   &lt;Rebuild Watchmodel 243&gt;
  sFinished retrieving data
  </code></pre>