1) For general, do not store results of such trivial computation (a+b) in database, save only the values needed for computing them. I don't see a point in keeping it.Do you have some ideas how this is done the right way?
2) You can save total values of VAT and price, this way you'll need to query just for one record to get total value of invoice, instead of querying for all invoice entries and add the prices. You are likely to do something like asking for a total income / VAT for a given day (or customer), keeping those values could help.
3) Maybe better would be to use a QSpinBox for quantity, this seems more natural to me. And maybe use a QLabel (or other non-editable widget) for total value + VAT, its not meant to be edited by users directly. Having all ui input items connected to a slot that refreshes the result seems ok. This may seem trivial but always validate user input before pushing data into database, this can save you some troubles.
Bookmarks