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

TextInput's positionToRectangle() reports weird x-values

    XMLWordPrintable

Details

    • 59ec66675b725f56111e4b133e79828bc6d5d95a

    Description

      Running the code below, there seems to be no logic to the reported rectangle's x-value.
      Dragging across the text when the cursor is at the start of the text, x quickly increas to
      802 and then stick there. Similar weirdness is seen when the cursor is at the end of the
      line.

      Rectangle {
          width: 640; height: 480;
          Rectangle {
              anchors.centerIn: parent
              width: 400; height: 25;
              color: "blue"
      
              TextInput {
                  anchors.fill: parent
                  color: "white"
                  focus: true
                  text: "Sea Shepherd campaigner Peter Bethune faces 15 years in jail after boarding whaling ship"
      
                  MouseArea {
                      anchors.fill: parent
                      onPositionChanged: { var rect = parent.positionToRectangle(mouse.x); print("positionToRectangle(mouseX).x: "
                                  + rect.x + ", y: " + rect.y + ", width: " + rect.width + ", height: " + rect.height); }
                  }
              }
          }
      }
      

      Attachments

        Issue Links

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

          Activity

            People

              aalpert-nokia Alan Alpert (closed Nokia identity) (Inactive)
              mathiasm Mathias Malmqvist
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes