QTreeView/QAbstractItemModel with Checkbox/Text
-
I have a QTreeView displaying data that is checkable, but I would like to be able to separate a click on the checkbox and a double click on the text. Double clicking will only check/uncheck the checkbox. I can't quite seem to figure out how to go about doing this. My work around was to create 2 columns and have the checkbox in one column and the text in the second column however this creates a problem where the more children there are the further away the collapse/expand icons with the checkbox are from the text/2nd column, and therefore making the QTreeView needing to be much wider than necessary to contain the data.
Any suggestions?
-
Take a look at this http://qt-project.org/wiki/QSortFilterProxyModel_subclass_to_add_a_checkbox.
but I have not used the ceckbox . I preferred to use the selected when I click . To select all the children I have created a recursive function that I select all the children of a folder.
However if you want to use the ceckbox check here :
http://qt-project.org/wiki/QSortFilterProxyModel_subclass_to_add_a_checkbox