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

Initial position of cursor is outside the TextEdit when part of ColumnLayout

    XMLWordPrintable

Details

    Description

      Following is the test code:

      1. In essence, it is a TextEdit within a Rectangle and the rectangle isin a ColumnLayout.
      2. When clicked, the cursor is positioned outside the TextEdit.
      3. Enter a character, and then the cursor moves to the expected position, based on vertical alignment.
      4. Middle and Bottom alignment suffer; Top alignment appears to function correctly.
      5. If TextEdit is set to fill its parent, the issue does not occur.
      import QtQuick 2.1
      import QtQuick.Layouts 1.0
      
      ColumnLayout
      {
          height: 200
          width: 500
      
          Rectangle
          {
              Layout.preferredHeight: 100
              Layout.fillWidth: true
      
              color: "yellow"
      
              TextEdit
              {
                  id: iTextEdit
      
                  height: parent.height
                  width:  parent.width
      //            anchors.fill: parent
                  verticalAlignment: Text.AlignBottom
      
                  function printPositionInfo()
                  {
                      console.log( "TextEdit x:" + iTextEdit.x +
                          " y: " + iTextEdit.y +
                          " width: " + iTextEdit.width +
                          " height: " + iTextEdit.height )
      
                      var cursorRect = iTextEdit.cursorRectangle;
                      console.log( "TextEdit Cursor Rectangle: x:" + cursorRect.x +
                          " y: " + cursorRect.y +
                          " width: " + cursorRect.width +
                          " height: " + cursorRect.height );
      
                      console.log( "\n" );
                  }
      
                  onCursorRectangleChanged: printPositionInfo()
      
                  Component.onCompleted: printPositionInfo()
              }
          }
      }
      
      

      Attachments

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

        Activity

          People

            smd Jan Arve
            balpeck@yahoo.com Balaji Ramachandran
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes