Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

[SOLVED] Text Area not Scrolling down to newest text when new text is added



  • Hi all,

    Ref: Qt Creator 5.2.1 MinGW for Windows platform.

    I have a Text Area in my program, and where I can write all my data to it, during runtime the text area does not scroll down to the newest data appended. How do I accomplish this? I've been through the QString class, and through the TextArea documentation, but cannot find a solution - can someone help shed some light on this subject??

    My QML:

    @ TextArea {
    id: data_output_window
    objectName: "data_output"
    x: 340
    y: 195
    width: 452
    height: 392
    text: ""
    font.family: "Verdana"
    font.pointSize: 8
    activeFocusOnPress: false
    readOnly: false
    }@

    My function call to it:
    @ if (dialog.size() >= 4048) string_strip();
    QQuickItem* object = myDialog->rootObject();
    QObject textback = object->findChild<QObject>("data_output");
    if (textback->lineCount > 20) string_strip();
    if (textback)
    {
    if (!left_inv)
    {
    dialog.append(en_left);
    textback->setProperty("text", dialog);
    left_inv = !left_inv;
    }
    else
    {
    dialog.append(left_unchk);
    textback->setProperty("text", dialog);
    left_inv = !left_inv;
    }
    }
    return;
    }@



  • Figured it out -

    @dialog.prepend(en_left);@

    Thanks all for looking!


Log in to reply