<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[TextArea won&#x27;t scroll up when new text added.]]></title><description><![CDATA[<p dir="auto">I have the following implementation of a simple console type window for scrolling text output:</p>
<pre><code>Rectangle {
    id: consoleOutput_rectangle
    x: 40
    y: 112
    width: 720
    height: 400
    color: "#ffffff"

    Flickable {
        id: flickable
        anchors.fill: parent
        contentWidth: consoleOutput_textArea.width
        contentHeight: consoleOutput_textArea.height
        flickableDirection: Flickable.VerticalFlick
        clip: true

        TextArea.flickable:
        TextArea {
            id: consoleOutput_textArea
            objectName: "ConsoleTextObject"
            anchors.fill: parent
            text: qsTr("Initial Text Area Text")
            wrapMode: Text.WordWrap
            onTextChanged: {
                console.log("OnTextChanged - height: " + consoleOutput_textArea.height + " " + flickable.height)
                if (consoleOutput_textArea.height &gt; flickable.height) {
                    flickable.contentY = consoleOutput_textArea.height - flickable.height
                    console.log("OnTextChanged - contentY changed to: " + flickable.contentY)
                }
            }
            function appendText(additionalText) {
                text += additionalText
            }
        }
        ScrollBar.vertical: ScrollBar {}
    }
}
</code></pre>
<p dir="auto">If I use this to add text at the bottom from C++ code, using the append function of TextArea:</p>
<pre><code>    QMetaObject::invokeMethod(mConsoleTextObject, "append", Q_ARG(QString, additionalText));
</code></pre>
<p dir="auto">it works except that append is line oriented, meaning it inserts a line feed after every line. So I added the appendText function seen in the QML above and invoke it like this:</p>
<pre><code>    QMetaObject::invokeMethod(mConsoleTextObject, "appendText", Q_ARG(QVariant, additionalText));
</code></pre>
<p dir="auto">It works, except that now the text does not scroll up when it reaches the bottom. The console.log statements indicate that the onTextChanged functions is being called and the contentY number seems to be correct.</p>
<p dir="auto">Am I missing some kind of repaint/update that's built into the native append? (I tried to call flickable.update() but it complained that the is no content in the flickable.)</p>
]]></description><link>https://forum.qt.io/topic/71243/textarea-won-t-scroll-up-when-new-text-added</link><generator>RSS for Node</generator><lastBuildDate>Wed, 14 Oct 2026 19:09:24 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/71243.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 14 Sep 2016 16:00:43 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to TextArea won&#x27;t scroll up when new text added. on Tue, 20 Sep 2016 14:49:51 GMT]]></title><description><![CDATA[<p dir="auto">@jpnurmi  - Thanks, that solved my problem.</p>
]]></description><link>https://forum.qt.io/post/348849</link><guid isPermaLink="true">https://forum.qt.io/post/348849</guid><dc:creator><![CDATA[Steve Fallows]]></dc:creator><pubDate>Tue, 20 Sep 2016 14:49:51 GMT</pubDate></item><item><title><![CDATA[Reply to TextArea won&#x27;t scroll up when new text added. on Thu, 15 Sep 2016 19:40:21 GMT]]></title><description><![CDATA[<p dir="auto">It is mentioned in the <a href="http://doc.qt.io/qt-5/qml-qtquick-textedit.html#append-method" target="_blank" rel="noopener noreferrer nofollow ugc">docs</a>:</p>
<blockquote>
<p dir="auto">Appends a new paragraph with text to the end of the TextEdit.</p>
<p dir="auto">In order to append without inserting a new paragraph, call <code>myTextEdit.insert(myTextEdit.length, text)</code> instead.</p>
</blockquote>
]]></description><link>https://forum.qt.io/post/347906</link><guid isPermaLink="true">https://forum.qt.io/post/347906</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Thu, 15 Sep 2016 19:40:21 GMT</pubDate></item><item><title><![CDATA[Reply to TextArea won&#x27;t scroll up when new text added. on Thu, 15 Sep 2016 02:03:48 GMT]]></title><description><![CDATA[<p dir="auto">Hi,<br />
please post full your qml code, I have tried it without problem.</p>
]]></description><link>https://forum.qt.io/post/347751</link><guid isPermaLink="true">https://forum.qt.io/post/347751</guid><dc:creator><![CDATA[atmel.ru]]></dc:creator><pubDate>Thu, 15 Sep 2016 02:03:48 GMT</pubDate></item></channel></rss>