Unsolved QlistWidget
-
hi everyone i need a way to read a text file in qlistwidget i use this code
QFile file(thefilename);
if(file.open( QIODevice::ReadOnly))
{
QString line = "";
while(!file.atEnd())
{
line = file.readLine();
ui->listWidget->addItem(line);
}
file.close();
}its working but it is show the words which in the file in the list widget 3 times i mean if i have 2 words i find it will repeat the 2 words 3 times in the list so can anyone help me to solve this problem
-
Hi,
Might be a silly question but are you sure that this function is not called several times with the same file ?