how to remove Item in Qtablewidget?
Unsolved
General and Desktop
-
Hi. Guys
my source code ↓
ui->tableWidget->setItem(0,7,new QTableWidgetItem(QString::number(3)));
ui->tableWidget->item(0,7)->setTextAlignment(Qt::AlignCenter);my way this.
delete ui->tableWidget->item(0,7);
If this memory is free?
If not let me know any other method.
-
@ForestPoem
May be deleting the pointer directly as mentioned here . -
When you set the item, The table takes ownership of the item. So just deleting the tableWidget should satisfy. If you want to selectively delete, what you are doing should be good enough.