[Qt-interest] QItemDelegate::setModelData() call doesn't work as expected

Michael Ernst ernst at sobex.de
Thu May 7 20:42:51 CEST 2009


Hi,

I'm using a QDataWidgetMapper to visualize some data from a 
QSql(Relational)TableModel. I want to write my own delegate, but for 
testing purposes I'm just forwarding the call to the QItemDelegate 
function.

I had a look at the SQL Widget Mapper example and it worked just fine. 
Then I tried to modify it so it would fit my needs. First I used my own 
delegate and it behaved as it should, after a widget lost its focus, the 
setModelData() function was called. My next step was to change the 
EditBehavior of the table model from OnManualSubmit to OnFieldChange, 
and that's when the behavior became not comprehensible for me anymore. 
The setModelData() function was called once, after a widget lost its 
focus as first, but that's it the function is not called again.

What am I missing here? I browsed the doc but I found nothing that would 
explain that kind of behavior.

Thanks for your help,

Michael

P.S.: Is it possible that the setModelData() function is called 
automatically after the text of a QComboBox changed?



More information about the Qt-interest-old mailing list