Hello,
Thanks a lot for the replies.
I found out another way by which we can hide the 'section' if the parent doesn't have any childrens.
ui.treeView->setRowHidden(parentRow, rootIndex, true)
In my example,
Fruits -
............Apple
............Orange
Animals -
.............Lion
.............Tiger
Colors -
............Red
............Green
............BLue
Fruits is 0th parent
Animals is 1st parent
Colors is the 2nd parent
So whenever any of the children's are missing ( which we come to know while filling up the model ), I am setting the respective "parent" row as hidden.
This approach worked fine and as expected.
Is anything wrong with this approach?
Model remains the same, only the view is hidden or unhidden based on some condition.
Please Let me know.