Mercurial > retraceit
diff 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 |
line wrap: on
line diff
--- a/src/libqxt/qxtcsvmodel.cpp Wed May 06 16:10:01 2015 +0200 +++ b/src/libqxt/qxtcsvmodel.cpp Wed May 06 17:17:13 2015 +0200 @@ -179,6 +179,7 @@ QChar quote; QChar ch, buffer(0); bool readCR = false; + int idx_nr = 1; // XXX added for retraceit QTextStream stream(file); if(codec) { stream.setCodec(codec); @@ -202,6 +203,7 @@ row << field; field.clear(); if(!row.isEmpty()) { + row.insert(0, headerSet ? QString::number(idx_nr++) : QString::fromLatin1("Index Nr.")); // XXX added for retraceit if(!headerSet) { d_ptr->header = row; headerSet = true; @@ -242,6 +244,7 @@ if(!field.isEmpty()) row << field; if(!row.isEmpty()) { + row.insert(0, headerSet ? QString::number(idx_nr++) : QString::fromLatin1("#Index Nr.")); // XXX added for relayit if(!headerSet) d_ptr->header = row; else