c++qtwebviewqml

QML text scroll


I am using C++ and QML to create a nice interface. I would like to have a "console view", where plenty to text is printed through time. However, when the text of a text item or webview content grows, the view does not "scroll down".

How can I make the text on the bottom of the text/webview item always stay visible?

I have tried playing with flickable and the_webview.evaluateJavaScript + window.scrollTo , but I could not get them to do what I want. This seems a fairly simple piece of UI, but I am having serious troubles to do it with QML.


Solution

  • funkybro answers inspired my final solution:

    function scroll_to_bottom() {
        flickabe_item.contentY = 
            Math.max(0, webview_item.height - flickabe_item.height);
        return;
    }
    

    Thanks !