Hide an item (delegate) in a ListView
-
Set its height to
-spacing
:PA problem with your solution is that if you scroll away and come back, the delegate will have beem reinstantiated and will be visible again.
You shouldn't store state in your delegates since they are not persistant.
A solution would be to have a toggle role in your model and filter your model with a QSortFilterProxyModel filtering on that role. -
Set its height to
-spacing
:PA problem with your solution is that if you scroll away and come back, the delegate will have beem reinstantiated and will be visible again.
You shouldn't store state in your delegates since they are not persistant.
A solution would be to have a toggle role in your model and filter your model with a QSortFilterProxyModel filtering on that role. -
Set its height to
-spacing
:PA problem with your solution is that if you scroll away and come back, the delegate will have beem reinstantiated and will be visible again.
You shouldn't store state in your delegates since they are not persistant.
A solution would be to have a toggle role in your model and filter your model with a QSortFilterProxyModel filtering on that role.@GrecKo said in Hide an item (delegate) in a ListView:
Set its height to -spacing :P
Thanks! That helped me too, on a similar problem where I swipe to "remove" the item from the list.
@GrecKo said in Hide an item (delegate) in a ListView:
A solution would be to have a toggle role in your model and filter your model with a QSortFilterProxyModel filtering on that role
Unfortunately, in my case, my model is a
XmlListModel
, which is read-only :-(. And even thought I use a Proxymodel on that, I haven't found a way to add some custom editable role to it (other than, of course parsing he XML file and store the data in an editable data model instead of usingXmlListModel
)@GrecKo said in Hide an item (delegate) in a ListView:
You shouldn't store state in your delegates since they are not persistant.
I avoid this problem by making sure the
cacheBuffer
property of theListView
is set to a sufficiently large value to keep all delegates in memory, since my list is not that large.