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

11th February 2011, 17: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 !

11th February 2011, 18: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.

14th February 2011, 17: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.

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