overwrite data inQTableView with QSqlQueryModel as source
-
Hi
I have a QSqlQuery set for QSqlQueryModel that produces a report.
theis model is set to a QTableView via a QSortFilterProxy model.If a user decides to change one value in the report , is it posilbe to change this value in the QTableView cell directly or would I need to create a dedicated model for that?
-
Hi,
How is the report linked to the model ?
-
Well the table is the report :)
I have found the way to do it , I'm not sure if it is the correct one,I have sublassed a QSqlQueryMOdel
I created a QMap<QModelIndex , QVariant > editedValues that is appended by a overriden setData (which also take care of DB value update)than an overriden data() checks if the index is among editedValues and if it is it returns the value or else it gets regular value from QSqlQuery::data() .
-
S Seb Tur has marked this topic as solved on