I have a QSqlTableModel
and a QTableView
displaying the contents of the model.
I've managed to customize the editing of models subclassing QStyledItemDelegate
and reimplementing the methods setEditorData
, setModelData
and updateEditorGeometry
.
What do I need to do now is put in the view a text based on the original model. Let me give a toy example:
Suppose I have stored the value "10"
in the model. What I want is to display a manipulated version of this value in the view, for example "10 kg"
, but without changing the actual content of the model.
(This was only a simplified example, the real problem is not just putting a suffix.)
How can I do this? I could not find the answer in the documentation and looking at the two examples I could find similar to my problem, but they deal with new representation, drawn as stars (for example). What I want is simpler: I want to be able to rewrite the string.
Sorry about the crap english.