QVector <QString> frequency;
QVector <QString> gain;
QString ref_data;
QStringList rowOfData;
QStringList rowData;
if (ReferenceData.open(QIODevice::ReadOnly | QIODevice::Text)) {
ref_data = ReferenceData.readAll();
rowOfData = ref_data.split("\n");
ReferenceData.close();
}
for (int x = 9; x < rowOfData.size(); x++) {
rowData = rowOfData.at(x).split(",");
frequency.push_back(rowData[0]);
gain.push_back(rowData[1]);
}
我从一个文件中读取了所有数据。当我使用push_back
时,我得到一个错误QList<T>::operator[] "index out of range"
。我也用过frequency.push_back(rowData.at(0));
,然后QList<T>::at "index out of range"
报错!
如何解决这个问题?