Important: Please read the Qt Code of Conduct -

CheckBox in QAbstractItemModel while using QStyledItemDelegate in the view

  • I might be missing something obvious, but i have the following problem:

    I am using QStyledItemDelegate to make treeview cells editable. Sometimes the field to edit is boolean and i use a QCheckBox. I also use the CheckStateRole in the QAbstractItemModel to show a checkbox when not editing.

    What happens is that when not editing everything is fine, but when editing the editable checkbox is placed next to the QAbstractItemModel checkbox, instead of replacing it or painting over it or whatever. I's like to use the delegate for editing of the checkbox for consistency sake.

    I would like to solve this elegantly, if possible, not make an exception only for boolean values.

    Cheers, Lars

Log in to reply