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. TextFields' cursorPosition has no effect
Qt 6.11 is out! See what's new in the release blog

TextFields' cursorPosition has no effect

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 655 Views 1 Watching
  • 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.
  • ocgltdO Offline
    ocgltdO Offline
    ocgltd
    wrote on last edited by ocgltd
    #1

    I have created a simple TextField with a long text therein. Every time I run the code the LAST part of the text fields shows. Since I set cursorPosition to 1, shouldn't the FIRST part of the text field show?

                        TextField {
                            x: 0
                            id: inputField
                            width: 100
                            text: "Hello World 2! ababaabababababababa"
                            color: gui.colorRGBString(GUIConstants.EColorElement_TextTitle)
                            maximumLength: 128
                            cursorPosition: 1
                        }
    
    1 Reply Last reply
    0
    • IntruderExcluderI Offline
      IntruderExcluderI Offline
      IntruderExcluder
      wrote on last edited by
      #2

      Component.onCompleted: cursorPosition = 1 will do the trick, but not sure why TextField have such behaviour.

      ocgltdO 1 Reply Last reply
      0
      • IntruderExcluderI IntruderExcluder

        Component.onCompleted: cursorPosition = 1 will do the trick, but not sure why TextField have such behaviour.

        ocgltdO Offline
        ocgltdO Offline
        ocgltd
        wrote on last edited by ocgltd
        #3

        @IntruderExcluder I did figure out the workaround, the behavior just did not make sense to me (since cursorPosition only makes sense once the item is initialized). I assume this bug is already logged somewhere....

        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