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

TextEdit.verticalAlignment broken

    XMLWordPrintable

Details

    Description

      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"
              }
          }
      }
      
      

      Attachments

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

        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