s4eed
s4eed

Reputation: 7891

Get rid of cell widget in QTableWidgetItem

As you may know, you can set a widget for a cell in a QTableWidget using setCellWidget:

table->setCellWidget(0, 0, new QProgressBar);

In some circumstances, I just want to get rid of this widget and everything becomes like when there was no cell widget. I tested setting widget to nullptr but It wasn't helpful.
In other words, What is the default widget of a cell in QTableWidget?

Upvotes: 1

Views: 942

Answers (1)

eyllanesc
eyllanesc

Reputation: 243965

You have to use void QTableWidget::removeCellWidget(int row, int column)

In your case:

table->removeCellWidget(0, 0);

Upvotes: 1

Related Questions