maarvi
28th June 2011, 08:17
hello every one i am facing a problem . i have a list view in which i am displaying the items retrieved from the file my file is my file each line of file contain tab separated entries (sample file attached) but when i display it in my list view, item didnt appear aligned.here is the code
void list_load(QStandardItem * root)
{
FILE * f;
f=fopen("/home/cv/mod2an3run/output/mod3run/sample.txt","r");
if(f==NULL)
{ printf("not open");
root->appendRow(new QStandardItem("ash"));
}
QString buffer ="";
char ch = ' ';
while (ch!=EOF)
{
ch = fgetc(f);
if(ch!='\n')
{
buffer = buffer+ch;
}
if(ch=='\n')
{
QString status= range(prob);
buffer = buffer +"\t"+ status ;
root->appendRow(new QStandardItem(buffer));
buffer="";
}
} //while end
fclose(f);
}// func end
i have attached my interface and sample file out put kindly help me to align my list box items
void list_load(QStandardItem * root)
{
FILE * f;
f=fopen("/home/cv/mod2an3run/output/mod3run/sample.txt","r");
if(f==NULL)
{ printf("not open");
root->appendRow(new QStandardItem("ash"));
}
QString buffer ="";
char ch = ' ';
while (ch!=EOF)
{
ch = fgetc(f);
if(ch!='\n')
{
buffer = buffer+ch;
}
if(ch=='\n')
{
QString status= range(prob);
buffer = buffer +"\t"+ status ;
root->appendRow(new QStandardItem(buffer));
buffer="";
}
} //while end
fclose(f);
}// func end
i have attached my interface and sample file out put kindly help me to align my list box items