PyQt QDataWidgetMapper submit doesn't work

Posted by DSblizzard on Stack Overflow See other posts from Stack Overflow or by DSblizzard
Published on 2010-03-26T23:37:05Z Indexed on 2010/03/26 23:43 UTC
Read the original article Hit count: 508

Filed under:
|

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?

© Stack Overflow or respective owner

Related posts about pyqt

Related posts about qt