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

The vertical centering of Chinese text in TextInput is not correct

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 6.6.1
    • GUI: Font handling
    • None
    • Ubuntu x11/wayland
    • Linux/Wayland, Linux/X11

    Description

      When specifying a Chinese text for TextInput, it will lead to invalid vertical centering, even though verticalAlignment: TextInput.AlignVCenter was specified.

      Based on my tests,  this issue occurs under Ubuntu x11/ wayland, but works fine on Windows.

      Additionally, marking  autoScroll: false can perform as a workaround for this problem.

      The code and screenshot are as follows, and the complete project can also be downloaded in the attachment.

       

      import QtQuick
      import QtQuick.ControlsWindow {
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")    Rectangle {
              id: rec
              x: 100
              y: 200
              width: 400
              height: 100
              border.width:1
          }    TextInput {
              id: textEdit
              anchors.fill: rec
              text: "这是一段中文"
              font.pixelSize: 30
              verticalAlignment: TextInput.AlignVCenter
              padding: 0
              // Uncomment to align text vertically center
              // autoScroll: false
          }
      } 

       

      Attachments

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

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            warindy yi wang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes