Eh, so while doing what you asked for I found the issue, but I don't get why. The problem was with my model apparently, because doing:
model->fieldIndex("idStock")
model->fieldIndex("idStock")
To copy to clipboard, switch view to plain text mode
displayed -1 (other calls to fieldIndex displayed also the same value). I replaced its call in
QSqlTableModel *platsRelModel
= model
->relationModel
(model
->fieldIndex
("idStock"))
QSqlTableModel *platsRelModel = model->relationModel(model->fieldIndex("idStock"))
To copy to clipboard, switch view to plain text mode
by its value ('2') and it worked. Now my question is why the fieldIndex calls displayed -1 . Here you'll find the small example you asked for (in ZIP format) (and thank you again)
testDataWidgetMapper.zip
Bookmarks