Qt: QTableView how to add a row?

Michael Zelensky picture Michael Zelensky · Oct 29, 2012 · Viewed 23.6k times · Source

I have got a QTableView with data in it. What is the simplest way to add a row?

Thanks!

Answer

AlexBee picture AlexBee · Jul 29, 2014

As you use som YourModel to show it in YourTableView (QTableView) should do like this:

YourModel->insertRow(YourModel->rowCount(QModelIndex()));
// paste some data to new row

update of model causes update of View