Thanks for the suggestion wysota.
I can't emit sizeHintChanged() or set a member variable to the sizeHint() of the editor while inside the createEditor() or setEditorData() methods because these actions violate the method const-ness. In the sizeHint() method itself I don't have access to the editor widget to ask for a "sane" sizeHint() to pass back, which is why I was looking to capture the size at the point of widget creation. I can do something like:
QSize s
= QStyledItemDelegate
::sizeHint(option, index
);
s.setWidth(s.width() * 1.5);
return s;
QSize s = QStyledItemDelegate::sizeHint(option, index);
s.setWidth(s.width() * 1.5);
return s;
To copy to clipboard, switch view to plain text mode
in the sizeHint() method and the cell does get bigger but the result is not related to the size the editor thinks it should be. Is there a better way to determine a good size?
Bookmarks