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

TextEdit.verticalAlignment broken

XMLWordPrintable

      TextEdit always draws the text top aligned even though the verticalAlignment property was set to TextEdit.AlignVCenter or TextEdit.AlignBottom. The cursor on the other hand seems to be aligned correctly. Also the value returned by TextEdit.positionToRectangle does not take verticalAlignment into account but always return top-aligned coordinates.

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

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

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes