PDA

View Full Version : quick question on model/view programming



locus
2nd February 2007, 01:29
Hi,

Is there a way to check if changes made to a model (QSqlTableModel to be exact) has been submitted to the underlying sql database.

Meaning we are using OnManualSubmit and the changes are cached in the model but we have not yet called submitAll().

ie. i want to detect unsubmitted changes so i can warn my user before he/she closes the view.

wysota
2nd February 2007, 11:04
You can either call submitAll() just in case there are any changes or connect to the dataChanged() signal in the model to keep your own track of data changes. If the signal fires, just set some flag that the model has pending changes and on quit just check that flag and act accordingly.