If someone can help me to load the csv to load in the QTableWideget then it will be a greate resource for me to study.
Ok, study this and find you at least 5 differences from the your code. 
int main(int argc, char **argv)
{
if(!file.
open(QIODevice::ReadOnly|QIODevice
::Text)) msg.information(0,"Error!","Error opening file!",0);
else
{
myTable->setColumnCount(5);
int row=0;
while(!in.atEnd()){
loadCsv<<in.readLine().split(";");
if(!loadCsv.isEmpty())
{
myTable->insertRow(myTable->rowCount());
for(int col=0;col<5;++col){
if(col < loadCsv.size())
{
myTable->setItem(row,col,Items);
}
}
row++;
loadCsv.clear();
}
}
file.close();
window->setCentralWidget(myTable);
}
window->show();
return app.exec();
}
int main(int argc, char **argv)
{
QApplication app(argc, argv);
QMainWindow *window = new QMainWindow();
QMessageBox msg;
QFile file("Data.txt");
if(!file.open(QIODevice::ReadOnly|QIODevice::Text))
msg.information(0,"Error!","Error opening file!",0);
else
{
QTextStream in(&file);
QStringList loadCsv;
QTableWidget *myTable=new QTableWidget();
myTable->setColumnCount(5);
int row=0;
while(!in.atEnd()){
loadCsv<<in.readLine().split(";");
if(!loadCsv.isEmpty())
{
myTable->insertRow(myTable->rowCount());
for(int col=0;col<5;++col){
if(col < loadCsv.size())
{
QTableWidgetItem *Items= new QTableWidgetItem(loadCsv[col]);
myTable->setItem(row,col,Items);
}
}
row++;
loadCsv.clear();
}
}
file.close();
window->setCentralWidget(myTable);
}
window->show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks