[Interest] submit policy

Mark Brand mabrand at mabrand.nl
Thu May 24 16:48:55 CEST 2012


>> You're using QSqlTableModel, right? Have you tried adjusting
>> QSqlTableModel::EditStrategy to OnFieldChange?

> I am not using the QSqlTableMode, I am implementing my own 
> QAbstractItemModel, wrapping some driver calls to an USB device.
>
> But even if I would use QSqlTableModel, I would run into the same 
> problems, since "OnFieldChange" only makes sure that "All changes to 
> the model will be applied immediately to the database". My problem is 
> that the "changes to the model" come in too late already (they come in 
> on focus lost).

That's right, this is about the behavior of QDataWidgetMapper (sort of a 
"view") not the model. The OP wants changes to be submitted to the model 
even if the focus never leaves the mapped widget.

I'm pretty sure that this default behavior of QDataWidgetMapper is 
actually  defined by the delegate, which is QItemDelegate by default. 
You could use QDataWidgetMapper::setDelegate() to use your own 
subclassed delegate instead.

regards,

Mark



More information about the Interest mailing list