qt - How to stop ListView for "jumping" when model is changed -


what need do: need create chat window using listview in qml stores chat-messages. set listview.positionviewatend() in order follow last messages. disable positionviewatend when scroll upwards such can read past messages without jumping @ end every time receive new message.

the problem: after scrolling up, every time i receive new message jumps @ beginning of list. solve manage store contenty of list , reset every time oncountchanged handler called (see code below):

listview {     id: messageslist     model: contact? contact.messages: []     delegate: delegate     anchors.fill: parent     anchors.bottommargin: 20     height: parent.height     anchors.margins: 10      property int currentcontenty      onmovementended: {        currentcontenty = contenty     }      oncountchanged: {         contenty = currentcontenty     }     oncontentychanged: {         console.log(".....contenty: " + contenty)     } }    

the problem though set last contenty had, before model changed, list still jumps bit (several pixels, not @ end or beginning) , it doesn't jump always. , when go top of list , print contenty negative values. theoretically, contenty @ beginning of list should 0.

can tell me going wrong? or maybe suggest solution create message list?

than in advance! :)

why not use oncountchanged slot in order set listview @ end ?

oncountchanged: {    messageslist.positionviewatend() } 

Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -