I have a ListView table. I want to add some filter buttons to hide / show the elements of this table based on the type of element. The easiest way is to set the visible property of the element delegate. However, hidden items are still counted in listView.contentHeight or listView.visibleArea.heightRatio. As a result, these values ββchange during scrolling and affect the height and position of the scroll bar, it crashes, expands, jumps in any order.
Another problem is that in the listView element, if the element is selected, there is no way to find out its index, for example, it looks like it is in second place in the table, but in fact its index is higher due to invisible Items. It would be nice if invisible elements were not taken into account at all.
Please help solve this problem. Thanks to everyone.
ListView{ id: listView delegate: itemdelegate } Component{ id: itemdelegate Item{ visible: model.type === filteredType ? true: false } }
source share