I have got a QTableView with data in it. What is the simplest way to add a row?
Thanks!
The major difference between the two is that QTableView requires you to use an external class derived from QAbstractItemModel with it. The rowCount(), columnCount(), and data() methods for the item model are used by the table view to tell it how to fill in and format the table cells.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With