PDA

View Full Version : How to practically use QAbstractTableModel.submit\revert methods?



AlexVhr
6th October 2012, 17:07
I'm trying to do a record-based in-grid editing with a QAbstractTableModel-descendant class and a QTableView. When the editing is finished, the model recieves a signal to it's submit() or revert() slots. But there are no parameters, so the model does not know which record it needs to submit to (refresh from) a datastore. I've tried to setup my own change tracking inside model's setData()/removeRows()/insertRows() methods, but I do not think it's an optimal solution. What is the right way to do it?

Santosh Reddy
8th October 2012, 08:25
Why do you think it is not optimal solution?

You have rely on these functions, and implement internal (internal to model) caching or working and saved copy concepts optimally.

AlexVhr
8th October 2012, 10:27
Well, revert\submit is called every time a user finishes editing of a row, and it's implicitly stated in the docs that "This function is typically used for row editing", yet it lacks such a simple thing like an index parameter, which whould make things so obvious and simple. So I've thought I was missing something. But I guess I was not - thanks for clarifying that.