QAbstractItemView and tri state check boxes
	
	
		Hello
I have a model/view that allowed me to display a check box for each item in my tree and allowed the user to check or uncheck the item.
What I want, however, is that if an item has subitems and these are not all checked then the parent should be partially checked, if they are all checked the parent should be checked and if none are checked then the parent should be unchecked. This should of course be applied to the whole tree.
I am struggling to implement this and would be grateful if anyone has any suggestions on how I can achieve this
Thanks
Graham
	 
	
	
	
		Re: QAbstractItemView and tri state check boxes
	
	
		I would assume you are implementing a custom model to do so. In your model's data() method, when view requests for parent's checked status, you need to iterate through all the children, establish the checked status of the parent, and then return to it the view. You could call the data() method recursively for all the children of that parent
If your tree has a scope of growing larger enough for the iterations to slow down the GUI, then consider storing the pre-calculated checked status in the model data, so as to avoid the iteration on demand.