Qt Snippet: Remove all rows from QTableWidget

QTableWidget is the Qt widget that, as the name suggest, show a table composed by cells able to contain both native field like text or icon and also more complex widgets like listbox, checkbox and so on.

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:


This will have same effect of clear() and remove all rows.


Popular posts from this blog

Access GPIO from Linux user space

Launch an app from Android shell terminal

Qt 5 and " Failed to load platform plugin 'windows' " error