Thanks, it helped. But I have one more problem.
I tried to apply that:
itab -> setText("X");
for(int a=0;a<irows;a++)
for(int b=0;b<icols;b++) {
tableWidget->setItem(a, b, itab);
}
QTableWidgetItem *itab = new QTableWidgetItem;
itab -> setText("X");
for(int a=0;a<irows;a++)
for(int b=0;b<icols;b++) {
tableWidget->setItem(a, b, itab);
}
To copy to clipboard, switch view to plain text mode
Filling "X" works only for (0,0) cell, while running program, there is statement in compiling console:
"QTableWidget: cannot insert an item that is already owned by another QTableWidget"
If I have 4x3 table, this statement appears 4x3-1=11 times.
I tried to make an "itab" array, but it failed.
I think that itab needs some release from cell, but dunno how to do that.
________
EDIT 2 minutes later:
I did that:
for(int a=0;a<irows;a++)
for(int b=0;b<icols;b++) {
itab -> setText("X");
tableWidget->setItem(a, b, itab);
}
for(int a=0;a<irows;a++)
for(int b=0;b<icols;b++) {
QTableWidgetItem *itab = new QTableWidgetItem;
itab -> setText("X");
tableWidget->setItem(a, b, itab);
}
To copy to clipboard, switch view to plain text mode
And it works for me
.
Bookmarks