Skip to content

Commit 6ba9f4d

Browse files
committedApr 26, 2013
Fixing problem with very long data fields corrupting preview table (Qt framework not handling very long strings?)
1 parent eb220fd commit 6ba9f4d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed
 

‎src/providers/delimitedtext/qgsdelimitedtextsourceselect.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
#include <QTextCodec>
3131
#include <QUrl>
3232

33+
const int MAX_SAMPLE_LENGTH=200;
34+
3335
QgsDelimitedTextSourceSelect::QgsDelimitedTextSourceSelect( QWidget * parent, Qt::WFlags fl, bool embedded ):
3436
QDialog( parent, fl ),
3537
mFile( new QgsDelimitedTextFile() ),
@@ -425,6 +427,7 @@ void QgsDelimitedTextSourceSelect::updateFieldLists()
425427
for ( int i = 0; i < tblSample->columnCount(); i++ )
426428
{
427429
QString value = i < nv ? values[i] : "";
430+
if( value.length() > MAX_SAMPLE_LENGTH ) value = value.mid(0,MAX_SAMPLE_LENGTH)+"...";
428431
QTableWidgetItem *item = new QTableWidgetItem( value );
429432
tblSample->setItem( counter - 1, i, item );
430433
if ( ! value.isEmpty() )

0 commit comments

Comments
 (0)
Please sign in to comment.