Dynamically show/hide QTreeView items.
I have an application setting based on which I need to show/hide items in my QTreeView, but my model should remain same. I tried returning empty QVariant() in the decorationRole and displayRole and returning QSize(0,0) in sizeHintRole. But the invisible items do not resize to zero height. How do I achieve this?
Have you had a look at QSortFilterProxyModel?
It's a very convenient way of filtering out parts of your model.
For such things, you typically 8use a QSortFilterProxyModel in between. Have a look at "models and views":http://doc.qt.nokia.com/4.7/model-view-programming.html#proxy-models
Thanks a lot guys, I should have read the docs more carefully.