Qt Snippet: Remove all rows from QTableWidget
Usually for Qt list widgets the method clear() remove all the rows currently showed in the control. However, also if present, this call doesn't work for QTableWidget control. If you want to remove all the rows from QTableWidget you need to simply set the number of rows to zero as follow:
MyTable->setRowCount(0);
This will have same effect of clear() and remove all rows.
clear() sort of works with QTableWidgets (PyQt5). It removes the data, but leaves blank lines.
ReplyDeleteUsing setRowCount() and horizontalHeader().setVisible(True/False) and setHorizontalHeaderLabels(array) lets me make the app look and behave exactly as I want.
Thanks