title: Qt - QTableView and QSqlQueryModel items disappear
body: <p>I'm implementing a QtableView with the data from a QSqlQueryModeL.</p>
  
  <p>What happens is, if I select a item in the view, the item after a second disappears and the items in the other rows disappear as well.</p>
  
  <p>my code:
  ui->medicstableView->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
      ui->medicstableView->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
      ui->medicstableView->setStyleSheet(QString::fromUtf8("background-color: rgb(227, 226, 226);"));
      //ui->medicstableView->setVisible(true);
      //ui->medicstableView->setEditTriggers(QAbstractItemView::NoEditTriggers);</p>
  
  <pre><code>doctors_table = new QSqlQueryModel(this);
  
  QSqlDatabase mydb;
  QString Squery;
  
  QString conn = mydb.connectionName();
  if (conn.isEmpty()) {
      mydb = QSqlDatabase::addDatabase("QMYSQL");
  }
  else
  {
      mydb.close();
      QSqlDatabase::removeDatabase(conn);
      mydb = QSqlDatabase::addDatabase("QMYSQL");
  }
  
  mydb.setHostName(myhost);
  mydb.setUserName(myuser);
  mydb.setPassword(mypass);
  mydb.setDatabaseName(mybase);
  
  try
  {
      if(mydb.open()==true)
      {
          Squery=QString("SELECT id_medico,medico FROM Registos_Medicos");
          doctors_table-&gt;setQuery(Squery);
  
          doctors_table-&gt;setHeaderData(0, Qt::Horizontal, QObject::tr("ID"));
          doctors_table-&gt;setHeaderData(1, Qt::Horizontal, QObject::tr("Nome do médico"));
  
          ui-&gt;medicstableView-&gt;setModel(doctors_table);
  
          mydb.close();
  
          //ui-&gt;statusbar-&gt;addAction();
  
          ui-&gt;medicstableView-&gt;resizeColumnsToContents ();
          ui-&gt;medicstableView-&gt;resizeRowsToContents ();
          ui-&gt;medicstableView-&gt;setColumnWidth(1,255);
  
          ui-&gt;medicstableView-&gt;show();
  </code></pre>
  
  <p>The QTableView is created in the Qt Designer with the name "medicstableView"</p>
  
  <p>Thanks in advance.</p>