in my csv file values decimalpoint is a comma. So I can open the csv in Excel and Excel won't format my values to date.
When I open the file in my own software and convert the String to float, the values can't be read: bool ok returns false.
QTextStream stream(&file);
QLocale locale = QLocale();
qDebug() << locale.decimalPoint(); //returns ","
stream.setLocale(locale);
QString LineFromFile = stream.readLine();
QStringList DataFromRow = LineFromFile.split(";");
QList<float> values;
for (int i = 0; i < ValuesCnt; ++i){
values.append(DataFromRow.at(i).toFloat());
qDebug() << DataFromRow.at(i) << values.at(i); //returns e.g.: "700,1" 0
}
You set the locale for the stream, this does not work presumably, because I don't think that the locale is transferred to the element of the QStringList object DataFromRow. You have to set the locale to them. However, I would prefer using the following:
See qt's documentation of QLocale::toDouble()