Mercurial > retraceit
comparison src/libqxt/qxtcsvmodel.cpp @ 37:0c05958d254c
(issue 13, 6) Add constant index number column to data and view
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Wed, 06 May 2015 17:17:13 +0200 |
parents | 73efe717b944 |
children | 89997d853bf6 |
comparison
equal
deleted
inserted
replaced
36:92bb9687d716 | 37:0c05958d254c |
---|---|
177 QStringList row; | 177 QStringList row; |
178 QString field; | 178 QString field; |
179 QChar quote; | 179 QChar quote; |
180 QChar ch, buffer(0); | 180 QChar ch, buffer(0); |
181 bool readCR = false; | 181 bool readCR = false; |
182 int idx_nr = 1; // XXX added for retraceit | |
182 QTextStream stream(file); | 183 QTextStream stream(file); |
183 if(codec) { | 184 if(codec) { |
184 stream.setCodec(codec); | 185 stream.setCodec(codec); |
185 } else { | 186 } else { |
186 stream.setAutoDetectUnicode(true); | 187 stream.setAutoDetectUnicode(true); |
200 readCR = false; | 201 readCR = false; |
201 if(ch != separator && (ch.category() == QChar::Separator_Line || ch.category() == QChar::Separator_Paragraph || ch.category() == QChar::Other_Control)) { | 202 if(ch != separator && (ch.category() == QChar::Separator_Line || ch.category() == QChar::Separator_Paragraph || ch.category() == QChar::Other_Control)) { |
202 row << field; | 203 row << field; |
203 field.clear(); | 204 field.clear(); |
204 if(!row.isEmpty()) { | 205 if(!row.isEmpty()) { |
206 row.insert(0, headerSet ? QString::number(idx_nr++) : QString::fromLatin1("Index Nr.")); // XXX added for retraceit | |
205 if(!headerSet) { | 207 if(!headerSet) { |
206 d_ptr->header = row; | 208 d_ptr->header = row; |
207 headerSet = true; | 209 headerSet = true; |
208 } else { | 210 } else { |
209 d_ptr->csvData.append(row); | 211 d_ptr->csvData.append(row); |
240 } | 242 } |
241 } | 243 } |
242 if(!field.isEmpty()) | 244 if(!field.isEmpty()) |
243 row << field; | 245 row << field; |
244 if(!row.isEmpty()) { | 246 if(!row.isEmpty()) { |
247 row.insert(0, headerSet ? QString::number(idx_nr++) : QString::fromLatin1("#Index Nr.")); // XXX added for relayit | |
245 if(!headerSet) | 248 if(!headerSet) |
246 d_ptr->header = row; | 249 d_ptr->header = row; |
247 else | 250 else |
248 d_ptr->csvData.append(row); | 251 d_ptr->csvData.append(row); |
249 } | 252 } |