Domanda

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())
È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top