[PySide] sanity checking a customcheckbox delegate

Frank Rueter frank at ohufx.com
Mon Sep 5 00:54:10 CEST 2022


Hi all,

I have written a delegate to get a simple checkbox in a cell.
To my surprise it all started working when I simply used
index.model().setData() inside the createEditor method.

I am please that it works but it doesn't feel right as I expected to have
to commit data or something (I might just be getting confused because I am
using  QTableWidget this time, not a view where one has to do a few more
things  manually)

This my delegate code:
https://pastebin.com/zgzTvcWQ

The table widget has a mousePresEvent that starts editing cells on click to
avoid having to triple click the checkbox.

So yeah, it seems to work, but can somebody have a quick peek and let me
know if this is reliable or if I should be doing more to complete the
editing of the model data properly?!

Cheers,
frank
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20220905/5126113c/attachment.htm>


More information about the PySide mailing list