Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-28677

TextInput.cursorRectangle isn't updated when the text property changes but not the cursorPosition

    XMLWordPrintable

Details

    Description

      A mouse press outside the text input in the example below changes the text from "aaaa" to the wider "WWWW", when this happens the cursorRectangle should be updated so that it remains positioned at the end of the text rather than somewhere in the middle of the expanded text as happens now.

      import QtQuick 2.0
      
      
      Rectangle {
          id: root
          width: 480; height: 480
      
          MouseArea {
              id: mouseArea
              anchors.fill: parent
              hoverEnabled: true
          }
      
          Rectangle {
              anchors.fill: textInput
              anchors.margins: -10
              color: "lightsteelblue"
          }
      
          TextInput {
              id: textInput
              anchors.centerIn: parent
              width: 300
      
              text: mouseArea.pressed ? "WWWW" : "aaaa"
              focus: true
      
              cursorDelegate: Rectangle {
                  color: "yellow"
                  width: 2
              }
          }
      }
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            andrew.den.exter Andrew den Exter
            andrew.den.exter Andrew den Exter
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes