Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to get coordinate of the TextArea current selection text?
Forum Updated to NodeBB v4.3 + New Features

How to get coordinate of the TextArea current selection text?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 136 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    senmx
    wrote on last edited by senmx
    #1
    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;
        }
    }
    
    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved