You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Wednesday, January 14th 2015, 12:47pm

data from CSV file to qtablewidget

is somone give me a code wich can read data from CSV file to be inserted in qtablewidget
i find this code but i dont understand the term "InjectionLocationsDialogExpanded" and what is the #include file ?(

voidInjectionLocationsDialogExpanded::importCSVFile(){QString fileName =QFileDialog::getOpenFileName(this,("Open File"),"/home",("csv File(*.csv)"));QString data;QFile importedCSV(fileName);QStringList rowOfData;QStringList rowData;int tempint =0;
data.clear();
rowOfData.clear();
rowData.clear();if(importedCSV.open(QFile::ReadOnly)){
data = importedCSV.readAll();
rowOfData = data.split("\n");
rowData = data.split(";");
importedCSV.close();}
qDebug()<< data;for(int x =0; x < rowOfData.size(); x++){for(int y =0; y < ui->tableWidgetInjectionLocationsExpandedDialog->columnCount(); y++){
ui->tableWidgetInjectionLocationsExpandedDialog->item(x,y)->setText(rowData[]);}}}