akshaysulakhe
16th July 2013, 08:59
Hello friends,
I am importing my language CSV file in Table widget. I don't want to wait for the open action, what i want is to load the CSV file as soon as i start the main application. Here is my CSV file processing code. Kindly let me know what to do, or atleast a few pointers. Thank you very much.
QString fileName = QFileDialog::getOpenFileName(this, ("Open File"), NULL, ("Language(*.csv)"));
QString data;
QFile importedCSV(fileName);
QStringList rowOfData;
QStringList rowData;
data.clear();
rowOfData.clear();
rowData.clear();
if (importedCSV.open(QFile::ReadOnly))
{
data = importedCSV.readAll();
rowOfData = data.split("\n"); //Value on each row
importedCSV.close();
}
for (int x = 0; x < rowOfData.size(); x++) //rowOfData.size() gives the number of row
{
rowData = rowOfData.at(x).split(";"); //Number of columns
// int r=rowData.size();
for (int y = 0; y < rowData.size(); y++)
{
mUI.languageTable->item(x,y)->setText(rowData[y]);
}
}
I am importing my language CSV file in Table widget. I don't want to wait for the open action, what i want is to load the CSV file as soon as i start the main application. Here is my CSV file processing code. Kindly let me know what to do, or atleast a few pointers. Thank you very much.
QString fileName = QFileDialog::getOpenFileName(this, ("Open File"), NULL, ("Language(*.csv)"));
QString data;
QFile importedCSV(fileName);
QStringList rowOfData;
QStringList rowData;
data.clear();
rowOfData.clear();
rowData.clear();
if (importedCSV.open(QFile::ReadOnly))
{
data = importedCSV.readAll();
rowOfData = data.split("\n"); //Value on each row
importedCSV.close();
}
for (int x = 0; x < rowOfData.size(); x++) //rowOfData.size() gives the number of row
{
rowData = rowOfData.at(x).split(";"); //Number of columns
// int r=rowData.size();
for (int y = 0; y < rowData.size(); y++)
{
mUI.languageTable->item(x,y)->setText(rowData[y]);
}
}