I am using Qt5.
I managed to connect to a sql database and using QtCreator
I have now a QTableView
that is nicely populated using SELECT * ...
from a test table I previously defined with MS SQL Manager...
Only one thing I would like to change:
...One column named "Error" has now numeric/integer values like: -101, -102, -105, and so on. To be honest I would prefer to have "Error opening file" instead of -101, also "Socket error" instead of -105, etc. you get the point.
Also, this "modification" must not affect the table in the database, but only the table-view.
Please, do you have any idea how I can do this?
You should create a subclass of
QSortFilterProxyModel
and reimplement itsdata
virtual method. It can be something like this:See the documentation to learn how to use proxy models.