G'day All,
I currently have a QSqlQueryModel that executes a query to aggregate a number of columns from a single table of potentially a few thousand rows and return a single row of totals. The query is dynamically built to include or exclude rows matching criteria based on a few flags. Every time the flags changes the model builds a query string and uses setQuery() to change its presented data (this process does not lend itself to a parameterised query).
The model drives a simple form through a QDataWidgetMapper. When I create the model, execute setModel() and toFirst() the form is updated with the model's default query values.
When the model flags change the query is changed, no error is raised (the query is good), but the view did not update automatically as I had expected it to. What I've done is to execute reset() in the model after setQuery() and connected the modelReset() signal to the mapper's toFirst() slot.
Is this the 'correct' Qt way to go about it? Are there better signals and slots I've missed?
Alternatively, is there a better way to achieve the goal, perhaps using QSqlTable Model and filtering proxy?
Any and all input gratefully accepted.
Bookmarks