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

QLineEdit::inputMethodEvent () called twice if enter first letter

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P2: Important
    • None
    • 5.10.1, 5.12.2
    • QPA
    • Android 6.0.1 (API32)

       
    • Android

    Description

      class LineEdit : public QLineEdit { 
      Q_OBJECT 
      public: 
         LineEdit(QWidget *parent = 0) : QLineEdit(parent) {} 
      protected: 
          void inputMethodEvent(QInputMethodEvent *e) 
          { 
              QString preedtingStr = e->preeditString(); 
              QString commitStr = e->commitString(); 
              QLineEdit::inputMethodEvent(e); 
          } 
      }
      
      

      If I enter the first character, for example "A" - inputMethodEvent() will be called twice, and the text is saved:

      1. In the first call preeditingStr is "A" and commitStr is "";
      2. In the second call preeditingStr is "" and commitStr is "A";
      3. onTextChanged() was emited

      If I enter the second character, for example, "B" - inputMethodEvent () will be called once:

      1. In the first call preeditingStr is "B" and commitStr is "";

      If I enter the third character, for example "C" - inputMethodEvent() will be called once:

      1. In the first call preeditingStr is "C" and commitStr is "";

      If I enter space - inputMethodEvent() will be called twice, and the text is saved:

      1. In the first call preeditingStr is "A" and commitStr is "";
      2. In the second call preeditingStr is "" and commitStr is "A";
      3. onTextChanged() was emited

      Attachments

        1. adnroidlineedit.zip
          72 kB
          Eugene Shirokov
        2. false.png
          56 kB
          Eugene Shirokov
        3. Screenshot_20190812-140003.png
          48 kB
          Eugene Shirokov
        4. true.png
          52 kB
          Eugene Shirokov
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            lukasz.kosiorowski lukasz.kosiorowski
            e.n.shirokov Eugene Shirokov
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes