Priority: P3: Somewhat important
Affects Version/s: 4.3.1
Fix Version/s: None
Component/s: SQL Support
It seems that to get a QDataWidgetMapper to work with a QSqlTableModel one has make sure it calls toFirst() (or setCurrentIndex) whenever the model selects( ) (which will happen without the programmer explicitly doing it).
Though this isn't too hard to do one could have expected this program to just work. Without uncommenting the emit selected() line only the first field is saved.
It seems to be because the internal QPersistentModelIndexes that the QDataWidgetMapper uses are invalidated. The delegate's setModelData function will be invoked with an invalid QModelIndex.
change the line edits to 123 and 456.
quit the application
restart the app
notice that 123 was saved but not 456.