[Interest] submit policy

Stefan nohoo77 at yahoo.com
Thu Jun 7 13:23:36 CEST 2012


Hi Mark,
thank you for your response!

I have been looking at the QItemDelegate class but am pretty unsure what method to override.
Can you point me to the right direction?

Thank you in advance

Stefan



________________________________
 From: Mark Brand <mabrand at mabrand.nl>
To: Stefan <nohoo77 at yahoo.com> 
Cc: Diego Schulz <dschulz at gmail.com>; "interest at qt-project.org" <interest at qt-project.org> 
Sent: Thursday, May 24, 2012 4:48 PM
Subject: Re: [Interest] submit policy
 
>> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120607/29fa62a7/attachment.html>


More information about the Interest mailing list