PDA

View Full Version : File Browser - problem with QListWidget



Eubie
8th August 2012, 15:14
Dear all,

I am trying to write a browser for large txt files, where each line contains "date time price deal_size". The files are large (2GB+) hence most editors crash (incl. Notepad++).
The main focus of the application is "I want a chunk of this file that is around a given date/time". Hence, I go through the file and want to load into memory some surrounding of this particular line., then I want to show this data from memory. I chose QListWidget for storing the resulting lines, however, I can"t make Qt display my data. My code is



int iItemNo = 0;
QString Item = QString::fromStdString( Tick.Date.szExport( QTDateStringFormat::YYYYMMDD_NoSlash ) ) + " ";
Item += QString::fromStdString( Tick.Time.szExport( QTTimeStringFormat::HHMMSS_NoColons_NoDots) ) + " ";
Item += QString::fromStdString( Tick.fPrice.szExport(1) + " " );
Item += QString::number( (int)Tick.iContract_Count );

ui->listWidget->insertItem( iItemNo++, Item );


After adding any number of Items, the Widget is still blank (visually). So the questions are two: is there a better widget for just showing lines of a textfile (the user mustnt have the possibility to modify lines, so no QTextEdit)? If not, what am I doing wrong with the QListWidget?

Any input is much appreciated,
Daniel