Hello!

I'm new to Qt and I'm using Qt eclipse integration with version 4.3.4 in Windows XP.
I've created a QTableView in the Eclipse's designer. The tableview is filled with a QSqlTableModel from a SQLite database and I set the sortingEnabled property to true.
When running the program and click in a column header all the table goes empty (the data and the headers)...

This is the code I have:
Qt Code:
  1. QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
  2. db.setDatabaseName("stock.sqlite");
  3. if (!db.open()) QMessageBox::critical(0, QObject::tr("Database Error"), db.lastError().text());
  4.  
  5. model = new QSqlTableModel(this);
  6. model->setTable("productes");
  7. model->select();
  8. ui.tableView->setSortingEnabled(true);
  9. ui.tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
  10. ui.tableView->setSelectionMode(QAbstractItemView::SingleSelection);
  11. ui.tableView->setModel(model);
To copy to clipboard, switch view to plain text mode 

What am I doing wrong? I tried a lot of things ( changing the propertys in the designer or after the setModel and I got the same result).

Thanks in advance.