PDA

View Full Version : QDataWidgetMapper does nothing on QComboBox when foreign key is null.



Jarvis
11th February 2011, 16:43
Hello everyone,

I feel quite disappointed about something obvious. It seems that there is no way to select item index -1 through a data mapper when the associated foreign key is NULL. I can't believe that the people who made that excellent framework did not think about that.

Does anyone have a workaround for this situation ?

Many thanks in advance !

wysota
11th February 2011, 17:38
Set a custom delegate on the widget mapper and reimplement setModelData() and setEditorData() for it. Then you can setup the combobox any way you want.

Jarvis
14th February 2011, 16:37
Thanks wysota. I met your answer on different pages. Sorry for that.

But I realized that the problem is somewhere else: my relational model does not contain the records having a null foreign key. As far as I can see, I am screwed.

Jarvis
16th February 2011, 00:42
I finally got it. That page could be removed...