PDA

View Full Version : implementing sizeHint in a QItemDelegate derivative



momesana
5th May 2010, 18:58
I am implementing an editable item model/view that uses delegates to provide custom editors. The editors are either QDoubleSpinBoxes or QComboBoxes. Now the size of the editor widget is very very small when displayed in the item view so I guess I have to reimplement the Delegates sizeHint. But how can I ask QStyle to tell me what the preffered size of a spinbox ?

Thanks in advance

norobro
5th May 2010, 21:13
Will putting the following line in yourDelegate::createEditor() not do what you want?
editor->setMinimumSize(editor->sizeHint());

momesana
5th May 2010, 21:59
When I use that in the createEditor function the editor widget is sort of shown outside of the cell as can be seen on the attached screenshot. This is however not the case when I use the sizeHint function.