Get scrollView scroll down automatically
-
Hi all,
In this code:
Column { anchors.fill: parent spacing: 10 TextField { id: txtField } Button { text: "Send" onClicked: { txtArea.text += txtField.text + '\n' txtField.text = "" } } ScrollView { width: parent.width / 2 height: width / 2 clip: true TextArea { id: txtArea width: 100; height: 50 background: Rectangle { color: "lightgray" } } } }
ScrollView
normally shows the first texts it receives, not the new ones, e.g., for texts:one, two, three, four, five respectively, it display them this way:
That is we have to scroll down to see last message sent, "five".
My goal is to have the scroll view go down when it receives a new text so that we scroll up (not down) when we intentionally want to view prior massages, just like a chat window.Is there any solution for that please?
By the way, I tried a couple of:
ScrollBar.horizontal.policy
s, but none worked the way expected! -
Hi all,
In this code:
Column { anchors.fill: parent spacing: 10 TextField { id: txtField } Button { text: "Send" onClicked: { txtArea.text += txtField.text + '\n' txtField.text = "" } } ScrollView { width: parent.width / 2 height: width / 2 clip: true TextArea { id: txtArea width: 100; height: 50 background: Rectangle { color: "lightgray" } } } }
ScrollView
normally shows the first texts it receives, not the new ones, e.g., for texts:one, two, three, four, five respectively, it display them this way:
That is we have to scroll down to see last message sent, "five".
My goal is to have the scroll view go down when it receives a new text so that we scroll up (not down) when we intentionally want to view prior massages, just like a chat window.Is there any solution for that please?
By the way, I tried a couple of:
ScrollBar.horizontal.policy
s, but none worked the way expected!