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

pyside6 QLineEdit, QTextEdit, QPlainTextEdit, QTableWidget Korean combination Error

    XMLWordPrintable

Details

    • Windows
    • 067b538641 (qt/qtbase/dev) 067b538641 (qt/tqtc-qtbase/dev) 41a4940fcd (qt/qtbase/6.3) 41a4940fcd (qt/tqtc-qtbase/6.3) 41a4940fcd (qt/qtbase/6.3.1)

    Description

      pyside6 There is a problem with Korean input when using QLineEdit and all QxxxEdit.

      There is a problem that the Korean combination with 'ㄲㅗㄹ' is not possible when entering '꼴' with the keyboard.

      I think this problem is similar to 'Qt CreatorQTCREATORBUG-27476'.

       

      'ㅃ', 'ㅉ', 'ㄸ', 'ㄲ', and 'ㅆ' are special Korean consonants and are expressed as 'ㅃ' when Shift + 'ㅂ'.
      I prepared the following code to analyze this problem. 

      class MyWidget(QtWidgets.QWidget):
      
       def _init_(self):
          super()._init_()
          self.text_edit = QLineEdit()
          self.text_edit.setAttribute(Qt.WA_InputMethodEnabled)
          self.text_edit.inputMethodEvent = self.print_korean
          self.text_edit.keyReleaseEvent = self.process_key
      
      def process_key(self, event):
          print('AlphabetEvent=', event)
      
      def print_korean(self, event):
          print('KoreanEvent=', event)
          print('\tpreeditString=(%s)'% event.preeditString(), '(%d)'% len(event.preeditString()))
          print('\tcommitString=(%s)'% event.commitString(), '(%d)'% len(event.commitString()))
      
      This is the test result.

      AlphabetEvent= <PySide6.QtGui.QKeyEvent(KeyRelease, Key_A, text="a")>
      AlphabetEvent= <PySide6.QtGui.QKeyEvent(KeyRelease, Key_B, text="b")>
      AlphabetEvent= <PySide6.QtGui.QKeyEvent(KeyRelease, Key_C, text="c")>
      AlphabetEvent= <PySide6.QtGui.QKeyEvent(KeyRelease, Key_D, text="d")>
      AlphabetEvent= <PySide6.QtGui.QKeyEvent(KeyRelease, Key_Space, text=" ")>
      KoreanEvent= <PySide6.QtGui.QInputMethodEvent(preedit="U+'\u314e'", attributes=

      {[type= 0, start=0, length=1, value=QVariant(QTextFormat, QTextFormat(QTextFormat::FormatType(2)))],[type= 1, start=0, length=0, value=QVariant(Invalid)]}
      )>

      preeditString=(ㅎ) (1)
      commitString=() (0)
      KoreanEvent= <PySide6.QtGui.QInputMethodEvent(preedit="U+'\ud558'", attributes=

      {[type= 0, start=0, length=1, value=QVariant(QTextFormat, QTextFormat(QTextFormat::FormatType(2)))],[type= 1, start=0, length=0, value=QVariant(Invalid)]}
      )>

      preeditString=(하) (1)
      commitString=() (0)
      KoreanEvent= <PySide6.QtGui.QInputMethodEvent(preedit="U+'\ud55c'", attributes=

      {[type= 0, start=0, length=1, value=QVariant(QTextFormat, QTextFormat(QTextFormat::FormatType(2)))],[type= 1, start=0, length=0, value=QVariant(Invalid)]}
      )>

      preeditString=(한) (1)
      commitString=() (0)
      KoreanEvent= <PySide6.QtGui.QInputMethodEvent(, commit="U+'\ud55c'")>
      preeditString=() (0)
      commitString=(한) (1)
      KoreanEvent= <PySide6.QtGui.QInputMethodEvent(preedit="U+'\u3131'", attributes=

      {[type= 0, start=0, length=1, value=QVariant(QTextFormat, QTextFormat(QTextFormat::FormatType(2)))],[type= 1, start=0, length=0, value=QVariant(Invalid)]}
      )>

      preeditString=(ㄱ) (1)
      commitString=() (0)
      KoreanEvent= <PySide6.QtGui.QInputMethodEvent(preedit="U+'\uadf8'", attributes=

      {[type= 0, start=0, length=1, value=QVariant(QTextFormat, QTextFormat(QTextFormat::FormatType(2)))],[type= 1, start=0, length=0, value=QVariant(Invalid)]}
      )>

      preeditString=(그) (1)
      commitString=() (0)
      KoreanEvent= <PySide6.QtGui.QInputMethodEvent(preedit="U+'\uae00'", attributes=

      {[type= 0, start=0, length=1, value=QVariant(QTextFormat, QTextFormat(QTextFormat::FormatType(2)))],[type= 1, start=0, length=0, value=QVariant(Invalid)]}
      )>

      preeditString=(글) (1)
      commitString=() (0)
      KoreanEvent= <PySide6.QtGui.QInputMethodEvent(, commit="U+'\uae00'")>
      preeditString=() (0)
      commitString=(글) (1)
      KoreanEvent= <PySide6.QtGui.QInputMethodEvent(preedit="U+'\u3147'", attributes=

      {[type= 0, start=0, length=1, value=QVariant(QTextFormat, QTextFormat(QTextFormat::FormatType(2)))],[type= 1, start=0, length=0, value=QVariant(Invalid)]}
      )>

      preeditString=(ㅇ) (1)
      commitString=() (0)
      KoreanEvent= <PySide6.QtGui.QInputMethodEvent(preedit="U+'\uc774'", attributes=

      {[type= 0, start=0, length=1, value=QVariant(QTextFormat, QTextFormat(QTextFormat::FormatType(2)))],[type= 1, start=0, length=0, value=QVariant(Invalid)]}
      )>

      preeditString=(이) (1)
      commitString=() (0)
      KoreanEvent= <PySide6.QtGui.QInputMethodEvent(preedit="U+'\uc789'", attributes=

      {[type= 0, start=0, length=1, value=QVariant(QTextFormat, QTextFormat(QTextFormat::FormatType(2)))],[type= 1, start=0, length=0, value=QVariant(Invalid)]}
      )>

      preeditString=(잉) (1)
      commitString=() (0)
      KoreanEvent= <PySide6.QtGui.QInputMethodEvent(, commit="U+'\uc774'")>
      preeditString=() (0)
      commitString=(이) (1)
      KoreanEvent= <PySide6.QtGui.QInputMethodEvent(preedit="U+'\uc57c'", attributes=

      {[type= 0, start=0, length=1, value=QVariant(QTextFormat, QTextFormat(QTextFormat::FormatType(2)))],[type= 1, start=0, length=0, value=QVariant(Invalid)]}
      )>

      preeditString=(야) (1)
      commitString=() (0)
      KoreanEvent= <PySide6.QtGui.QInputMethodEvent(preedit="U+'\uc597'", attributes=

      {[type= 0, start=0, length=1, value=QVariant(QTextFormat, QTextFormat(QTextFormat::FormatType(2)))],[type= 1, start=0, length=0, value=QVariant(Invalid)]}
      )>

      preeditString=(얗) (1)
      commitString=() (0)
      KoreanEvent= <PySide6.QtGui.QInputMethodEvent(, commit="U+'\uc57c'")>
      preeditString=() (0)
      commitString=(야) (1)
      KoreanEvent= <PySide6.QtGui.QInputMethodEvent(preedit="U+'\ud638'", attributes=

      {[type= 0, start=0, length=1, value=QVariant(QTextFormat, QTextFormat(QTextFormat::FormatType(2)))],[type= 1, start=0, length=0, value=QVariant(Invalid)]}
      )>

      preeditString=(호) (1)
      commitString=() (0)
      KoreanEvent= <PySide6.QtGui.QInputMethodEvent()>
      preeditString=() (0)
      commitString=() (0)
      AlphabetEvent= <PySide6.QtGui.QKeyEvent(KeyRelease, 0, text="ȣ")>
      AlphabetEvent= <PySide6.QtGui.QKeyEvent(KeyRelease, Key_Space, text=" ")>
      KoreanEvent= <PySide6.QtGui.QInputMethodEvent(preedit="U+'\u3146'", attributes=

      {[type= 0, start=0, length=1, value=QVariant(QTextFormat, QTextFormat(QTextFormat::FormatType(2)))],[type= 1, start=0, length=0, value=QVariant(Invalid)]}
      )>

      preeditString=(ㅆ) (1)
      commitString=() (0)
      AlphabetEvent= <PySide6.QtGui.QKeyEvent(KeyRelease, Key_Shift)>
      KoreanEvent= <PySide6.QtGui.QInputMethodEvent(preedit="U+'\uc2f8'", attributes=

      {[type= 0, start=0, length=1, value=QVariant(QTextFormat, QTextFormat(QTextFormat::FormatType(2)))],[type= 1, start=0, length=0, value=QVariant(Invalid)]}
      )>

      preeditString=(싸) (1)
      commitString=() (0)
      KoreanEvent= <PySide6.QtGui.QInputMethodEvent(preedit="U+'\uc30d'", attributes=

      {[type= 0, start=0, length=1, value=QVariant(QTextFormat, QTextFormat(QTextFormat::FormatType(2)))],[type= 1, start=0, length=0, value=QVariant(Invalid)]}
      )>

      preeditString=(쌍) (1)
      commitString=() (0)
      KoreanEvent= <PySide6.QtGui.QInputMethodEvent(, commit="U+'\uc30d'")>
      preeditString=() (0)
      commitString=(쌍) (1)
      KoreanEvent= <PySide6.QtGui.QInputMethodEvent(preedit="U+'\u3148'", attributes=

      {[type= 0, start=0, length=1, value=QVariant(QTextFormat, QTextFormat(QTextFormat::FormatType(2)))],[type= 1, start=0, length=0, value=QVariant(Invalid)]}
      )>

      preeditString=(ㅈ) (1)
      commitString=() (0)
      KoreanEvent= <PySide6.QtGui.QInputMethodEvent(preedit="U+'\uc790'", attributes=

      {[type= 0, start=0, length=1, value=QVariant(QTextFormat, QTextFormat(QTextFormat::FormatType(2)))],[type= 1, start=0, length=0, value=QVariant(Invalid)]}
      )>

      preeditString=(자) (1)
      commitString=() (0)
      KoreanEvent= <PySide6.QtGui.QInputMethodEvent(preedit="U+'\uc7a5'", attributes=

      {[type= 0, start=0, length=1, value=QVariant(QTextFormat, QTextFormat(QTextFormat::FormatType(2)))],[type= 1, start=0, length=0, value=QVariant(Invalid)]}
      )>

      preeditString=(장) (1)
      commitString=() (0)
      KoreanEvent= <PySide6.QtGui.QInputMethodEvent(, commit="U+'\uc790'")>
      preeditString=() (0)
      commitString=(자) (1)
      KoreanEvent= <PySide6.QtGui.QInputMethodEvent(preedit="U+'\uc73c'", attributes=

      {[type= 0, start=0, length=1, value=QVariant(QTextFormat, QTextFormat(QTextFormat::FormatType(2)))],[type= 1, start=0, length=0, value=QVariant(Invalid)]}
      )>

      preeditString=(으) (1)
      commitString=() (0)
      KoreanEvent= <PySide6.QtGui.QInputMethodEvent(preedit="U+'\uc74c'", attributes=

      {[type= 0, start=0, length=1, value=QVariant(QTextFormat, QTextFormat(QTextFormat::FormatType(2)))],[type= 1, start=0, length=0, value=QVariant(Invalid)]}
      )>

      preeditString=(음) (1)
      commitString=() (0)
       
      And it was assumed that the simultaneous occurrence of the Shift key event was the cause of this problem.
       

      Afterwards, as a temporary solution, I was able to avoid the korean combination problem by receiving the Shift event as follows.

       

       
        self.text_edit.keyReleaseEvent = self.process_key
      def process_key(self, event):
         pass
      

       
      The core of the problem is that the Shift key pressed at the same time should be ignored when entering special characters such as 'ㅃ'.

      I hope this issue will be resolved soon.

       

      Attachments

        1. image-2022-06-03-15-52-33-294.png
          image-2022-06-03-15-52-33-294.png
          170 kB
        2. image-2022-06-03-15-52-39-425.png
          image-2022-06-03-15-52-39-425.png
          85 kB
        3. pyside1953.py
          1.0 kB
        4. qtbug103999.zip
          1 kB

        Issue Links

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

          Activity

            People

              anrocha André De La Rocha (Inactive)
              freemize Lee DaeGyun
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes