Updating RelationalTableModel with QDataWidgetMapper
I'm using QDataWidgetMapper in a simple fashion similar to the example in the "documentation":http://harmattan-dev.nokia.com/docs/library/html/qt4/qdatawidgetmapper.html.
In my use, I have a TableView backed by a RelationalTableModel. When I double-click one of the records, a form pops up that is properly populated using QDataWidgetMapper. However, changes to values in the form are not registered in the model. I am giving my mapper a ManualSubmit policy, and submitting when the user clicks 'Ok' in the modal popup form.
Edit: Actually my model does update. It's table view that doesn't display it, and must be refreshed somehow.
New question then: should my TableView be updating automatically when the underlying model change? Do I need to perform a manual refresh?
did you subclass the model? If so you have to care that the right signals are sent on data update to inform the view about the changes.
You're right. It turns out I don't need to subclass the model any more, so now everything works well. Question, why do I have to manage the signals if I subclass the model? Are those not inherited?
you have to take care of the signals whenever you do the data handling by yourself in the model. There is no automatic way for doing this, since you are the only one who knows how the data implemented.
Ah, it makes sense now. Thanks for the response!