PDA

View Full Version : Qt delegate model data and view



giusepped
27th July 2011, 11:30
I have a QSqlTableModel. One column has int data.
But: every int is related to a name. Practically, I have a vector of struct data. In the model I need the index of the name, but in the view I would show the name and not its index.
So, I used a delegate.
Everything is fine. I mean, when I double click the cell of the view (QTableView) the delegate goes in action and it show a ComboBox (that is what I needed).
But: when I leave that cell, the selected name disappears and re-appear its index in the model.
I think I have to modify the paint event, but I do not know if I am wrong.
Any help appreciated.