QSqltableModel BeforeUpdate??
-
Hi All,
I have form with tableview its model is a QSqlTableModel... User inserts a record with insertrows.. After inserting user can leave some fields blank .. When he/she changes the row model inserts the data to database.. I want to prevent inserting wrong or blank data to database beforeupdate how can I do this?
thanks..
Please be more examplish when explaning I'm a new bie..
-
Would enforcing rules in your database using triggers not help you here?
If you want to enforce your business rules in the model, you could subclass QSqlTableModel and re-implement the submit() method.
Or, change the model's EditStrategy to OnManualSubmit, create a 'Save' button and check the validity of the data in the button handler before calling the model's submitAll() method.