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

click Scence inputMethod does not disAppear when preview input chinese while use QGraphicsProxyWidget

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • None
    • 5.14.2, 5.15.0, 6.0.0 Beta2
    • None
    • OS:Ubuntu 20.04 x86_64
      Qt Version: Qt5.15.0 Qt6.0
      Compiler: x86_64-linux-gnu
      Executed from Qt Creator in Debug mode.
    • Linux/X11
    • bf5011815d917e07ae7cf45e5768f1775f70e90d (qt/qtbase/dev) 7c77201b68bdda64ed25fcbdff46bd9710b378a3 (qt/qtbase/5.15)

    Description

      phenomenon:

      1. when use QGraphicsProxyWidget  proxy QTextEdit or QLineEdit and type chinese;
      2. the fcitx-pinyin appear preview effect;
      3. when you click scence, inputMethod does not disappear;
      4. and up to now, i test has no preview inputMethod also has this error;
      5. i test for QGraphicsTextItem, QGraphicsTextItem work fine.

      Recurrence steps:

      1. create QGraphicsScene  and add QGraphicsProxyWidget;
      2. then QGraphicsProxyWidget add QTextEdit or QLineEdit(which can recive inputMethod)
      3. use fcitx-pinyin inputMethod type chinese and appear preview effect;
      4. click scence,but inputMethod does not disappear; (as you see, widget text is  error QGraphicsProxyWidget work error)

      Reason analysis:

      1. the reason why QGraphicsTextItem work fine is QGraphicsTextItem call function: 
        QApplication::inputMethod()->reset(); 

        when** focusOutEvent and focusInEvent response.

      1.  i am try to override QGraphicsProxyWidget focusOutEvent named MyQGraphicsProxyWidget, and add this test code:     
        if (this->widget()->testAttribute(Qt::WA_InputMethodEnabled)) QApplication::inputMethod()->reset();

        it was work fine.the issue has been solved.(as you see, widget text is  right QGraphicsProxyWidget work right)**


      How to Edit with Qt:

      1. QGraphicsProxyWidget::focusInEvent  and QGraphicsProxyWidget::focusOutEvent should be call QApplication::inputMethod()->reset() function , when proxy Widget has Qt::WA_InputMethodEnabled  attribute;
      2. this edit method same as QGraphicsTextItem, inputMethod disappear or not, commit or not, it's up to inputMethod,but we need tell inputMethod we not use input or need reset inputMethod.

      Appendix description:

      1. proxy.zip is test code demo;
      2. baiduInput.mp4 is use fcitx-baidu InputMethod which has no preview effect;
      3. pinyinInputmethod.mp4 is use fcitx-pinyin InputMethod which has preview effect;
      4. both of all use fcitx input.

      Attachments

        1. baiduInput.mp4
          894 kB
        2. pinyinInputmethod.mp4
          825 kB
        3. proxy.zip
          3 kB

        Activity

          People

            bibr Andreas Aardal Hanssen
            kingderzhang kingderzhang
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: