My initialization code calls the checkPrefs()
The view does appear on the desktop.
Debug statements show that the model has the correct data from the table in the correct database. Debug shows no database errors. 'open' is = "Y" and 'log' is not empty. But, the view on the desktop has no data showing in it.
What could be wrong?

Qt Code:
  1. void MainWindow::initializeModel(QSqlTableModel *model) {
  2. model->setTable("log");
  3. model->select();
  4. }
  5.  
  6. QTableView * MainWindow::createView(QString logTitle, QSqlTableModel *model) {
  7. QTableView *view = new QTableView;
  8. view->setModel(model);
  9. view->setWindowTitle(logTitle);
  10. return view;
  11. }
  12.  
  13. void MainWindow::checkPrefs() {
  14. ControlDB ctrl;
  15. QString open = ctrl.getOpenLastLog();
  16. QString log = ctrl.getLastLog();
  17.  
  18. if (open == "Y") {
  19. if (log != "") {
  20. QString logName = log + "_log";
  21. Connection conn;
  22. bool base = conn.createConnection(logName);
  23.  
  24. initializeModel(&model);
  25.  
  26. QTableView *view1= createView(log, &model);
  27. model.select();
  28. view1->show();
  29. }
  30. }
  31. }
To copy to clipboard, switch view to plain text mode