Hi,
I'm creating a QTableWidged based on my text file like this:
char readword[50]="";
for(i=0; i<6; i++)
{
for(j=0; j<5; j++)
{
fscanf(input,"%s", &readword);
refTable->setItem(i, j, refItem);
}
}
char readword[50]="";
for(i=0; i<6; i++)
{
for(j=0; j<5; j++)
{
fscanf(input,"%s", &readword);
QTableWidgetItem *refItem = new QTableWidgetItem(QString("%1").arg(readword));
refTable->setItem(i, j, refItem);
}
}
To copy to clipboard, switch view to plain text mode
Then I'd like to see if I get the correct entru back out of the table (testing with location 1,1):
QString celltext; celltext
=item
->text
();
char print
[50];
strcpy(print, celltext.
toLocal8Bit().
constData());
fprintf(output,"%s\n", print);
QTableWidgetItem *item = refTable->item(1,1);
QString celltext; celltext=item->text(); char print[50]; strcpy(print, celltext.toLocal8Bit().constData());
fprintf(output,"%s\n", print);
To copy to clipboard, switch view to plain text mode
However, I'm not getting the same text back as what was in the input file. I'm getting text from a location other than 1,1.
I'd be very thankful for any help. It seems that I don't know how to handle QTAbleWidget or QTableWidgetItem
Bookmarks