How to delete all rows from QTableWidget

前端 未结 10 1874
自闭症患者
自闭症患者 2021-01-31 14:57

I am trying to delete all rows from a QTableWidget . Here is what I tried.

for ( int i = 0; i < mTestTable->rowCount(); ++i )
{
    mTestTable->removeRo         


        
10条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-31 15:32

    AFAIK setRowCount(0) removes nothing. Objects are still there, but no more visible.

    yourtable->model()->removeRows(0, yourtable->rowCount());
    

提交回复
热议问题