3

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())
Bart
  • 19,692
  • 7
  • 68
  • 77
  • 1
    If you managed to solve your problem, make it an answer instead. And you can even accept it. That is both accepted and recommended. So don't hesitate to do that. – Bart Mar 03 '13 at 16:46

1 Answers1

0

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())