QTableWidget's. setText() does not set any text to cells
Unsolved
General and Desktop
-
Hello,
I use QTableWidgetItem to insert some text to cells in a table but all that happens is that it crashes with a segmentation error. Code below:QTableWidgetItem *item = new QTableWidgetItem;
item = ui->tablewidget->item(2, 2);
item->setText("danny");so when the last line executes it crashes with a segmentation fault that takes me to some at header file ?.
any ideas?
regards
Frik Brits -
Try,
QTableWidgetItem *item = new QTableWidgetItem;
item->setText("danny");
ui->tablewidget->setItem(2, 2, item);