[SailfishDevel] Read-only TextArea: Always keep the lines added last visible
Dirk Zimmermann
me+sailfishos at dirkz.com
Fri Jan 2 07:58:03 UTC 2015
Hi all,
I was trying to use a TextArea as a UI-visible debug log, so I can see
connection error details while I'm out using my app. The basic principle
is that the python code (pyotherside) will make a server request and
send detailed answers to the text area, which displays them. Everything
works find, except the text area doesn't auto scroll to the end when
there is more content than fits on the page. autoScrollenabled seems to
mean something entirely different, selectionStart start seems to be
read-only. I have put up an example that demonstrates, at the end of the
mail.
Does anyone know of the magic incantations needed to make sure the
latest lines are always visible?
import QtQuick 2.0
import Sailfish.Silica 1.0
Page {
id: textAreaLogExample
SilicaFlickable {
TextArea {
id: textAreaLog
readOnly: true
text: "Test"
autoScrollEnabled: true
}
}
Timer {
interval: 500; running: true; repeat: true
onTriggered: {
textAreaLog.text += "\n" + new Date().getUTCSeconds() + " Log"
}
}
}
More information about the Devel
mailing list