Quote Originally Posted by chithara View Post
I have a QTreeView with Custom Read-only Model derived from QAbstractItemModel. (Followed Qt example:SimpleTreeModel).
1. Do i need to call removeRows() on the selected index ? I don't think this will help as the items to be deleted are not coming from the view.
2. Do i need to loop through the childCount() and delete each ?
If you have a read-only model then you cannot call removeRows() or removeRow(); these public methods modify the model content from outside.

During refresh call, I want to clear/delete all the child nodes under the selected parent node index. What should be the best way to achieve this ?
What is being refreshed? If the data underlying your read-only model (i.e. the private data that is being presented) is changing then you need to make matching beginInsertRows()/endInsertRows() or beginRemoveRows()/endRemoverows() calls in your model's code so that views using the model receive appropriate signals.