I am using QSqlQuerModel in my program and using table view to display the contents of the model.
But when i set the model nothing displays in the table other than two brown lines at the horizontal and verticla headers.....
my program code....



Qt Code:
  1. void win::on_pushButton_clicked()
  2. {
  3.  
  4. QStringList signalList;
  5. QString filename;
  6. filename="C:/Users/Desktop/abc.txt";
  7. headersList=GetheaderNames(filename);
  8.  
  9. QFileInfo file(filename);
  10. createTable(file.baseName(),headersList);
  11. GetFileContent(filename);
  12. QSqlQueryModel plainModel2;
  13. initializeModel(&plainModel2,file.baseName(),headersList);
  14.  
  15. ui->tableView_2->setModel(&plainModel2);
  16. }
To copy to clipboard, switch view to plain text mode 



initialiseModel function
Qt Code:
  1. void initializeModel(QSqlQueryModel *model,QString filename, QStringList headersList)
  2. {
  3. QString queryString=QString("select * from %1").arg(filename);
  4.  
  5. model->setQuery(queryString);
  6. for(int i=0;i<headersList.count();i++)
  7. {
  8. model->setHeaderData(i, Qt::Horizontal, (headersList.at(i)));
  9. }
  10.  
  11. }
To copy to clipboard, switch view to plain text mode 


plz help me to sort out the problm here!!