PDA

View Full Version : CheckStateRole: multiple checkstates and click events



BreakBad
17th July 2012, 22:42
My goal is to have 2 checkstates in my QAbstractItemTable instead of one, and therefor two checkboxes per row. I did not come up with much after searching, any suggestions or links would be appreciated. My assumption is I'll have to override the paint method and perhaps define a new role, is this feasible?

Also, looking for a good approach on how to catch the click on the checkboxes; specifically wanting to allow the user to check/uncheck each row without changing the selection. So far I've implemented the event method and handle the click event, but unsure how to test if the click event was clicked on the checkbox or the row.

TYVM for any feedback.

wysota
18th July 2012, 07:27
My assumption is I'll have to override the paint method and perhaps define a new role, is this feasible?
Yes.


Also, looking for a good approach on how to catch the click on the checkboxes
QAbstractItemDelegate::editorEvent()


but unsure how to test if the click event was clicked on the checkbox or the row.
You have to calculate that the same way as you calculate where to draw the checkbox.