Change position of a ScrollView
Solved
QML and Qt Quick
-
Hello,
I have a kind of pop up window with a scroll view that I change the visibility of to hide or shows it. I want to change the position of the scroll when I change the visibity. The thing is that I don't know how to set the scrollview position automatically.
Can anybody help me with this ?
Thank you in advance
-
I tried to find a solution for Controls 2 and found only this thread, so I reply here after finding the solution by the hard way myself.
In Controls 2 ScrollView has run time contentItem which is Flickable (undocumented feature). This Flickable has contentY and contentX properties, see the official docs how to use them. For example, I made a function in a ScrollView which has TextArea with id 'edit':
function scrollToBottom() { contentItem.contentY = edit.height - contentItem.height }
This seems to work.