Set model not working!!
General and Desktop
5
Posts
3
Posters
2.4k
Views
1
Watching
-
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....
@ void win::on_pushButton_clicked()
{QStringList signalList; QString filename; filename="C:/Users/Desktop/abc.txt"; headersList=GetheaderNames(filename); QFileInfo file(filename); createTable(file.baseName(),headersList); GetFileContent(filename); QSqlQueryModel plainModel2; initializeModel(&plainModel2,file.baseName(),headersList); ui->tableView_2->setModel(&plainModel2); }@
initialiseModel function
@
void initializeModel(QSqlQueryModel *model,QString filename, QStringList headersList)
{
QString queryString=QString("select * from %1").arg(filename);model->setQuery(queryString); for(int i=0;i<headersList.count();i++) { model->setHeaderData(i, Qt::Horizontal, (headersList.at(i))); } }@