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

maximumLength of QML TextInput cannot limit the length of preeditText for certain input methods

    XMLWordPrintable

Details

    • Android, Windows

    Description

       

      Here is a sample:

      Window {
          id: root
          width: Screen.width
          height: Screen.height
          visible: true
      
          Column {
              Rectangle {
                  width: root.width - 100
                  height: 50
                  border.color: "#000000"
      
                  TextInput {
                      id: input
                      anchors.fill: parent
                      anchors.margins: 1
                      maximumLength: 15
                  }
              }
      
              Text {
                  text: `PreeditText: ${input.preeditText}`
              }
      
              Text {
                  text: `DisplayText: ${input.displayText}`
              }
          }
      }
      

      On Windows:
      If input method is English, then everything is fine, that user can only type in up to 15 letters.
      But if the input has preeditText, e.g. Japanese, then the string being displayed during user input can be arbitrarily long. The string is only chopped off after being actually entered.
      Strangely, Chinese input is not affected.

      On Android (11):
      The problem is prevalent since even English input has preeditText. Then whenever user is typing anything, the string being displayed on screen can exceeds limit until string is entered.

      Some screenshots are attached. It can be observed that preeditText, so does the temporary string being displayed, can exceed limit for Japanese input on Windows. English input on Windows is all good since it does not have preeditText. But Chinese input is unexpectedly limiting the preeditText too. And on Android, English input is not being constrained at all due to preeditText. Nevertheless, excessive letters/characters are automatically removed after being entered on all platforms for all input methods.

      inputMask is affected in the same way. For example:

      inputMask: "aaaaaaaaaaaaaaa"
      

      does not limits the length of preeditText but chops it off after entering.

      Attachments

        1. Android_EN.png
          Android_EN.png
          68 kB
        2. Windows_CN.png
          Windows_CN.png
          20 kB
        3. Windows_EN.png
          Windows_EN.png
          6 kB
        4. Windows_JP.png
          Windows_JP.png
          12 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            inho Inho Lee
            luqiaochen Luqiao Chen
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes