mimic
mimic

Reputation: 5224

Qt: how to update model?

I'm trying to use Model-View approach in my app. I have a TableView that is filled by data. And I have several outside fields to edit data. As soon as I click the row I take the data from tableview's field and put into outside field. Then I want when I click the button the data into tableview to be updated from the field. How to do that?

Thanks

Upvotes: 1

Views: 8167

Answers (1)

Neel Basu
Neel Basu

Reputation: 12904

QAbstractItemModel has a signal QAbstractItemModel::dataChanged(const QModelIndex & topLeft, const QModelIndex & bottomRight) that you need to emit when an Item is changed.

QAbstractItemView has a slot QAbstractItemView::update(const QModelIndex & index) that you can call to update an item in a cell

Upvotes: 3

Related Questions