I am afraid that you will have to tell us because it is your code.I have a little experience with delegates but this behavior is very confusing. Can someone explain how the Qt:: DisplayRole value is getting changed in the model without the proxy delegate paint() function being called?
The Qt::DisplayRole of the standard models reflects a default conversion from the QVariant value you get on the Qt::EditRole. If there is an implicit QString conversion from whatever you are putting on the data then that is probably what you will get in the Qt::DisplayRole. In custom models you get complete control over what each role returns to the model consumers.
View delegates have nothing to do with the data returned by models. Delegates are attached to a view and called when a view needs to display an item. The QStyledItemDelegate::paint() method should render the value returned from the model using whatever visual is appropriate. The delegate can do some rudimentary changes to what it displays using the QStyledItemDelegate::displayText() method, but this does not alter the model or the data seen anywhere else.
Bookmarks