The better way is make use of a custom proxy model, and not disturb the QSqlQueryModel. Moreover implementing QSqlQueryModel::setData() may not be practical as you don't know how the QSqlQueryModel stores the data internally.
The proxy model will add the extra column.
Bookmarks