Honestly I don't see a point of doing that if the default delegate already does it.
The code is in my previous post. It's taken directly from Qt sources.But i am still confused as to how to implement a custom painted checkbox which will be visible at all times.
It's not a "normal" checkbox. It uses the code from my previous post.My current code has the normal checkbox working using Qt::CheckStateRole as you suggested earlier. Now, if i want to add custom drawing to it, what should i do?
Could you first say what is the effect you want to achieve that is not available by default?Suppose, i write a custom delegate to display a checkbox at all times. So, i'll rewrite the paint function of the delegate to display a virtual checkbox at all times. In addition, to support editing of the checkbox (check/uncheck) by the user, i need to rewrite the createEditor(), setEditorData() and setModelData() functions in the custom delegate.
Why would you want a real checkbox? What's wrong with the one the CheckStateRole provides?So, when the application runs, user will see a virtual checkbox because of the paint() function of the custom delegate and if the user clicks the checkbox, the delegate should go into edit mode and have a real checkbox.
Bookmarks