| 108 | } |
| 109 | |
| 110 | static QStringList splitLine(const QString &line) |
| 111 | { |
| 112 | QStringList sl = line.split(QLatin1Char(',')); |
| 113 | QStringList ret; |
| 114 | for (int i = 0; i < sl.size(); i++) { |
| 115 | // get rid of leading and trailing whitespace and quotes |
| 116 | QString s = sl.at(i).simplified(); |
| 117 | if (s.startsWith(QLatin1Char('\"'))) { |
| 118 | s.remove(0, 1); |
| 119 | } |
| 120 | if (s.endsWith(QLatin1Char('\"'))) { |
| 121 | s.remove(s.length() - 1, 1); |
| 122 | } |
| 123 | ret.append(s); |
| 124 | } |
| 125 | return ret; |
| 126 | } |
| 127 | |
| 128 | bool TableModel::loadFromCSV(const QString &filename) |
| 129 | { |
no test coverage detected