tags:

views:

108

answers:

0

Here is the parts of code (Mw - main window, Ed - edit dialog, Tv - table view):

Mw.mapper = QDataWidgetMapper(Mw)
Mw.mapper.setSubmitPolicy(QDataWidgetMapper.ManualSubmit)
Mw.mapper.setItemDelegate( QSqlRelationalDelegate(Mw.mapper) )
Mw.mapper.setModel(Table.Model)
# Id - first invisible key column
Mw.mapper.addMapping(Ed.leName, Name) # Name == 1
Mw.mapper.addMapping(Ed.leSize, Size) # Size == 2
Mw.mapper.toFirst()

Row = Tv.currentIndex().row()
Mw.mapper.setCurrentIndex(Row)
Ed.setModal(1)
Ed.show()

Res = Mw.mapper.submit() # False
Table.Model.submitAll()

SQL UPDATE statement works in this case. Why problem with mapper?