PDA

View Full Version : QDataWidgetMapper issue



vitaly
2nd June 2007, 20:45
Hi

I have a QSqlTableModel with OnFieldChange edit strategy. To view the model contents I have a QTableView and several editing (QLineEdit) controls which display some cells of QTableView's current row. These editing controls are connected with the model by the QMapper. I have the connection of QTableView->selectionModel()->currentRowChanged() to the QDataWidgetMapper's slot setCurrentModelIndex(). So when the current row is changed the mapper automatically updates the edit controls.

I make some changes in first edit control. Then I move focus to the next edit control by pressing tab and try to change its value. The value which was changed in the second control would not be saved into the model. The reason when I move focus to the next edit control the QTableView resets its selection state. So the current row becomes invalid in the table. QDataWidgetMapper has an invalid current model row.

Do you have any ideas or an experience how to solve this issue?

Thank you in advance,
Vitaly

wysota
3rd June 2007, 03:28
You could try submitting the data first before setting a new index in the mapper.