⚠️ Forum Maintenance: Feb 6th, 8am - 14pm (UTC+2)

How to get coordinate of the TextArea current selection text?

  • ScrollView {
        id: scroll
        width: parent.width
        height: parent.height
        contentWidth:  width
        contentHeight: col.height
        Column {
            id: col
            width: parent.width
            anchors.fill: parent
            TextArea {
                id: text
                readOnly: true
                width: parent.width
                textFormat: Text.RichText
                selectByMouse: true
        Component.onCompleted: {
            let i = 100;
            text.cursorPosition = i;
            text.moveCursorSelection(i+10, TextEdit.SelectCharacters);
            //How to get the Y corrdinate of the current selection text? Then I would like scroll to the corresponding position.
            let y = 0;

Log in to reply