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

Changing TextInput's echoMode changes (resets?) the inputMethodHints

    XMLWordPrintable

    Details

      Description

      STEPS LEADING TO PROBLEM:
      1. Open the attached code in qmlviewer in device
      2. Tap the blue rectangle (input field) and input some text to it
      3. Tap the red rectangle (changes the echoMode) and see the text getting
      revealed. Observe also the console, where the current inputMethodHints value of
      input field is logged.
      4. Input more text to input field and see the suggestion dialog popping up.
      5. Tap one of the suggestions and see it adding extra space to field value
      5. Tap the red rectangle again so that password mode is enabled and observe the
      console.

      EXPECTED OUTCOME:

      The inputted additional text should not be using predictive text mode. All the
      values logged to console should be the same (= inputMethodHints value should be
      the same all the time, regardless of the echoMode).

      ACTUAL OUTCOME:

      The additional text is inputted in predictive text mode (suggestions shown etc)
      and values logged to console are 34, 0, 35, 0, 35, ... (34 is the correct one
      in this case).

      INFORMATION:

      The actual issue can be seen via clicking the red rectangle and observing the
      logged values, but via using the input field one can see the real problem as it
      is seen by the end user = terrible UX.

      The reason for changing the echoMode (in our case) is to allow the user to use
      a checkbox to reveal the password he has inputted (or is about to input). If he
      wants, he should be able to input the password in normal text mode (but without
      the predictive text mode, obviously).

      I tested this also with some older images, the oldest one being 13-4, and the
      issue was visible there, too. It wasn't, however, until now this was discovered
      in our app (NoA account plugin), so it might be that this is a (recent)
      regression issue.

      TEST CASE:

      import QtQuick 1.1
      
      Column{
          width: 500
          height: 500
      
          Rectangle {
              color: "blue"
              width: 300
              height: 40
      
              TextInput {
                  anchors.fill: parent
                  id: ti2
                  echoMode: TextInput.Password
                  inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase
              }
          }
      
          Item { height: 30; width: parent.width }
      
          Rectangle {
              width: 100
              height: 40
              color: "red"
      
              MouseArea {
                  anchors.fill: parent
                  onClicked: {
                      ti2.echoMode = (ti2.echoMode == TextInput.Password) ?
      TextInput.Normal : TextInput.Password
                      //ti2.inputMethodHints = Qt.ImhNoPredictiveText |
      Qt.ImhNoAutoUppercase // enabling this fixes the problem
                      console.log("IMH = " + ti2.inputMethodHints);
                  }
              }
          }
      
          Component.onCompleted: console.log("IMH = " + ti2.inputMethodHints)
      }
      

        Attachments

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

          Activity

            People

            Assignee:
            denexter Andrew den Exter (closed Nokia identity) (Inactive)
            Reporter:
            tapadar Indrajit Tapadar (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes