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

TextInput.positionToRectangle does not take verticalAlignment into account

    XMLWordPrintable

Details

    Description

      The y coordinate reported by TextInput.positionToRectangle seems to be zero always even though the vertical aligment was set to AlignVCenter or AlignBottom. Try changing the cursor position (by clicking) with the following example:

      (There seems to be another bug that the initial value for "rect" is (0, 0, 0, 0))

      import QtQuick 2.0
      
      Item {
          width: 200; height: 300
      
          Rectangle {
              anchors.fill: textInput
              border.width: 1
              border.color: "black"
          }
      
          TextEdit {
              id: textInput
              width: 100; height: 80
              anchors.centerIn: parent
              horizontalAlignment: TextInput.AlignHCenter
              verticalAlignment: TextInput.AlignBottom
              text: "Testing"
              focus: true
      
              Rectangle {
                  property var rect: textInput.positionToRectangle(textInput.cursorPosition)
                  x: rect.x
                  y: rect.y
                  width: rect.width
                  height: rect.height
                  color: "red"
              }
          }
      }
      
      

      Attachments

        For Gerrit Dashboard: QTBUG-23934
        # Subject Branch Project Status CR V

        Activity

          People

            denexter Andrew den Exter (closed Nokia identity) (Inactive)
            skananoj Sami Kananoja
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes