if insertRecord is the way to update a row how do I find the row number of the model? For instance, I just inserted a new record, what is the row number so I can call insertRecord to update the new record?
-
I have not found anything remotely similar to updateRecord() in a model! I} assume we are to use insertRecord() but with what row number?
i have a QTableView with a current row -- how do I find which is the row number of the model so I can call insertRecord??
-
I have not found anything remotely similar to updateRecord() in a model! I} assume we are to use insertRecord() but with what row number?
i have a QTableView with a current row -- how do I find which is the row number of the model so I can call insertRecord??
@jdent
I am not exactly sure, whatupdate the new record
means. Update an existing record, or insert a new one?
insertRecord()adds a new record to your table model. It doesn't do anything with the record's data.but with what row number
That depends.
currentIndex()is the currently selected index of anyQAbstractItemView. It has acolumn()and arow().
indexAt()will return the model index at a given point on the screen.
indexWidget()returns the pointer to a widget, in case you have set one.
In the model itself, you have plenty of accessors to retrieve or set item data to a given model index. All of those examples can be used to modify existing records (actually: indexes).