[Interest] Strange case with QStyledItemDelegate::setModelData
D. Brentjes
d.brentjes at gmail.com
Sun May 4 13:19:12 CEST 2014
Dear Interest group
Yet again I have found some strange behaviour of the QStyledItemDelegate
interface. When editing the a QTableView cell which contains a float the
setModelData function thinks it is handeling a QString. This was
discovered by the following piece of code: http://pastebin.com/jxiYYmxU .
Basically this converts an edited QString back to an std::string and
sets this data to the model. So when editing a float I noticed that I
got a String editor (very different from the one given for doubles) and
when confirming the edit with a <return> the value was being set to 0.
Also the String being output by my code says I'm editing a QString when
editing the float. For bools, doubles, and uint this is all the correct
type.
So is there something I'm missing so I will be able to distinguish
floats and QStrings being editied in the gui? Or is this some deliberate
decision?
Kind regards,
Dennis Brentjes
More information about the Interest
mailing list