Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Editor created by QStyledItemDelegate is not inheriting container width
Colin James last edited by Colin James
I'm currently working on a program that has an editor component built on a
QListViewthat uses a
QStyledItemDelegateto draw the item in the list. I'm using
createEditorto 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.
Colin James last edited by
I eventually managed to fix this by implementing
editor->setGeometry(option.rect);. I should have looked into base class member functions sooner!