Zooming into ListView doesnt work
-
Hey, I have a ListView and I want to zoom in and out on it. The zooming itself works fine, but it is not zooming into the middle of the listview, but scrolls up while zooming https://streamable.com/o1frzj (As you can see it moves up towards the top of the listview).
I suppose the problem is the 3rd parameter of Flickable.resizeContent (thezoomPoint). I can't find a way to set it to a value that results in a zooming towards the middle of my screen.This is my zoom function:
function zoom(factor) { let newWidth = listView.contentWidth * factor; var zoomPoint = Qt.point(listView.width/2 + listView.contentX, listView.height/2 + listView.contentY); listView.resizeContent(Math.round(newWidth), Math.round(newWidth / listView.currentItem.pageRatio), zoomPoint); listView.returnToBounds(); }Does someone have an idea why it doesn't scroll into the middle of the screen?
Thanks in advance -
I have created a minimal example of my problem: https://gist.github.com/DavidLazarescu/58ae4c1f60a007326b2b6ea7bc5fcd66, in this video: https://streamable.com/8cxjre you can see that it is not scrolling into the middle of the listview