Editor created by QStyledItemDelegate is not inheriting container width
-
I'm currently working on a program that has an editor component built on a
QListView
that uses aQStyledItemDelegate
to draw the item in the list. I'm usingcreateEditor
to create another widget for editing the selected list item's contents but, no matter what widget I use, it does not inherit the full width of the list cell.I've looked at all the layout and geometry settings to no avail.
Below is an image that demonstrates the issue:
As you can see, the editor widget is offset to the left by quite a bit. My understanding was that the editor is just an overlay and should inherit the region/rect that the delegate has.
Any insight would be much appreciated.
-
I eventually managed to fix this by implementing
updateEditorGeometry
and callingeditor->setGeometry(option.rect);
. I should have looked into base class member functions sooner!