I found the solution. What I did above was right but the mapper wasn't auto submitting the data. What I did was:
self.ui.calendar.selectionChanged.connect(self.ui.mapper.submit())
質問
I currently have my calendar widget mapped using QDataWidgetMapper like this (using PySide):
self.mapper.addMapping(self.ui.calendar, 2, "selectedDate")
And it does display the correct date when I do:
self.mapper.toFirst()
But my problem is that when I change the selected date clicking on a different date the mapping doesn't capture the change and save it to the database. In other words, the mapper does not issue a setData on the model or setModelData in case I choose to use a delegate.
What I am missing?
Edit: I found the solution. What I did above was right but the mapper wasn't auto submitting the data. What I did was:
self.ui.calendar.selectionChanged.connect(self.ui.mapper.submit())
解決
I found the solution. What I did above was right but the mapper wasn't auto submitting the data. What I did was:
self.ui.calendar.selectionChanged.connect(self.ui.mapper.submit())