[Interest] submit policy

Stefan nohoo77 at yahoo.com
Thu May 24 08:55:21 CEST 2012

Hi Diego,

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). However I need the "changes to the model" already on QWidget::valueChanged (which doesn't exist on QWidget level), preferable time delayed for QLineEdits and QComboBoxes.

Thank you for your input 


 From: Diego Schulz <dschulz at gmail.com>
To: "interest at qt-project.org" <interest at qt-project.org> 
Sent: Thursday, May 24, 2012 12:41 AM
Subject: Re: [Interest] submit policy
On Mon, May 21, 2012 at 9:15 AM, Stefan <nohoo77 at yahoo.com> wrote:
> Hello,
> this question is about the submit policy in QDataWidgetMapper.
> There is an AutoSubmit, which submits to the itemModel on focus lost.
> Also, there is a ManualSubmit, submitting only when called programatically.
> I prefer to use the auto submit policy, since I don't want to have an ok
> button on my dialog needing to be pressed in order to make the change
> permanent. I like that the data is changed immediatly.
> Unfortunately the data is not being submitted until the user defocuses the
> currently changed widget, which he might or might not.
> Eventually he will, one might thinkg, but in my case the connected ItemModel
> is a wrapper to an externally connected device sitting on the users desk,
> which he can access in parallel. In fact he is now checking this device for
> his currently made change, but since the autosubmit policy didn't fire yet,
> he gets a weird user experience.
> The same problem will occur with centralized databases, being accessed by
> multiple clients. One client changes a value in a widget and goes to lunch.
> The other client still sees the old data.
> Does anybody know of a creative way to come up with a custom submit policy?
> Like a SubmitOnValueChanged ? Or even a "timedelayed submit on value
> changed"-policy ?
> Please help
> This is bothering me for weeks now and nobody else at google seems to know
> :)

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

> Thank you for any helpful input
> Stefan
Interest mailing list
Interest at qt-project.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120523/349cb863/attachment.html>

More information about the Interest mailing list