PDA

View Full Version : Help with QTableWidget!



bottin
24th July 2009, 15:16
Hi all,

I create a QTableWidget, with a determined number of rows and collumns, now i need initialize all values in 0, i can initialize this, but is so slowly. In this moment i use this method to make it.

size = rows = collumns



QTableWidgetItem *tableItem;
tableItem = new QTableWidgetItem();
tableItem->setText("0");
for(int i=0; i < size; i++){
for(int j=0; j < size; j++){
ui->tableWidgetMatrix->setItem(i,j,tableItem);
}
}


Is possible to make it diferent? Because i work with more than 500 rows and collumns!
Sorry my english, and thanks for helps!
Fernando Bottin

Lykurg
24th July 2009, 16:10
Hi, instead of inserting new items for chance the value, use the already existing ones. Just change their values! -> QTableWidget::item().
And 500x500 changes need their time...

EDIT: also see QWidget::updatesEnabled().