Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for WebAssembly
  4. Unable to input Chinese (Chinese characters) ?

Unable to input Chinese (Chinese characters) ?

Scheduled Pinned Locked Moved Solved Qt for WebAssembly
23 Posts 10 Posters 4.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • lorn.potterL Offline
    lorn.potterL Offline
    lorn.potter
    wrote on last edited by
    #3

    Qt for WebAssembly currently does not support using local (system) fonts.
    https://bugreports.qt.io/browse/QTBUG-81736

    You can add fonts to a resource file or download the fonts into the platform sandbox and then use
    QFontDatabase::addApplicationFont or
    QFontDatabase::addApplicationFontFromData(b) to load the font.

    You can then pick your font from the font chooser.

    That part would work. Whether it will display correctly and be able to actually input might be a hit and miss right now. I have not been able to test font handling lately.

    Freelance Software Engineer, Platform Maintainer QtWebAssembly, Maintainer QtSensors
    Author, Hands-On Mobile and Embedded Development with Qt 5 http://bit.ly/HandsOnMobileEmbedded

    J 1 Reply Last reply
    1
    • lorn.potterL lorn.potter

      Qt for WebAssembly currently does not support using local (system) fonts.
      https://bugreports.qt.io/browse/QTBUG-81736

      You can add fonts to a resource file or download the fonts into the platform sandbox and then use
      QFontDatabase::addApplicationFont or
      QFontDatabase::addApplicationFontFromData(b) to load the font.

      You can then pick your font from the font chooser.

      That part would work. Whether it will display correctly and be able to actually input might be a hit and miss right now. I have not been able to test font handling lately.

      J Offline
      J Offline
      Jonix King
      wrote on last edited by
      #4

      @lorn-potter Thank you very much.
      I know how to display Chinese characters normally:

          int fontId = QFontDatabase::addApplicationFont(QStringLiteral(":/fonts/msyh.ttf"));
          QStringList fontFamilies = QFontDatabase::applicationFontFamilies(fontId);
          if ( fontFamilies.size() >0 )
          {
              QFont font;
              font.setFamily(fontFamilies[0]);
              app.setFont(font);
          }
      

      But ...
      Just can't input Chinese characters
      The problem made it impossible for me to start Chinese software. @_@

      J 1 Reply Last reply
      0
      • J Jonix King

        @lorn-potter Thank you very much.
        I know how to display Chinese characters normally:

            int fontId = QFontDatabase::addApplicationFont(QStringLiteral(":/fonts/msyh.ttf"));
            QStringList fontFamilies = QFontDatabase::applicationFontFamilies(fontId);
            if ( fontFamilies.size() >0 )
            {
                QFont font;
                font.setFamily(fontFamilies[0]);
                app.setFont(font);
            }
        

        But ...
        Just can't input Chinese characters
        The problem made it impossible for me to start Chinese software. @_@

        J Offline
        J Offline
        jineter
        wrote on last edited by
        #5

        @Jonix-King 解决了吗?不能输入的问题点在哪里?是否可以通过修改qt源代码的方式进行支持?

        J 1 Reply Last reply
        0
        • W Offline
          W Offline
          wenqing zhong
          wrote on last edited by wenqing zhong
          #6

          what do you mean "can't input Chinese characters"?
          Cannot input chinese words when run in web-browser? I never meet that situation.
          Cannot input chinese words in QT creator linux? May be, but you can find solution in the network. In windows, never heard of such problem.

          1 Reply Last reply
          0
          • W Offline
            W Offline
            wenqing zhong
            wrote on last edited by
            #7

            No, I am wrong! that is really a fatal problem. Line edit in wasm can only input english and number, but not Chinese characters. Now I can only paste the Chinese words to input widget. That is realy a nightmare.

            1 Reply Last reply
            0
            • J jineter

              @Jonix-King 解决了吗?不能输入的问题点在哪里?是否可以通过修改qt源代码的方式进行支持?

              J Offline
              J Offline
              Jonix King
              wrote on last edited by
              #8

              @jineter 已知唯一解决方案是在WASM中自己做一个输入法。已经有人搞出了虚拟键盘+拼音输入,据说可以满足需求。由于不肯开源只看到了截图。em编译器的说明中没有看到输入法限制方面的说明,无法判断是否是em的原因所致;但感觉Qt自身原因的可能性更大一些。

              G W 2 Replies Last reply
              0
              • J Jonix King

                @jineter 已知唯一解决方案是在WASM中自己做一个输入法。已经有人搞出了虚拟键盘+拼音输入,据说可以满足需求。由于不肯开源只看到了截图。em编译器的说明中没有看到输入法限制方面的说明,无法判断是否是em的原因所致;但感觉Qt自身原因的可能性更大一些。

                G Offline
                G Offline
                Guo Tao
                wrote on last edited by
                #9

                @Jonix-King You can derive a custom Edit widget from QLineEdit, replace the subclass original QLineEdit, and solve Chinese input.

                J 1 Reply Last reply
                0
                • J Jonix King

                  @jineter 已知唯一解决方案是在WASM中自己做一个输入法。已经有人搞出了虚拟键盘+拼音输入,据说可以满足需求。由于不肯开源只看到了截图。em编译器的说明中没有看到输入法限制方面的说明,无法判断是否是em的原因所致;但感觉Qt自身原因的可能性更大一些。

                  W Offline
                  W Offline
                  Wei Wei
                  wrote on last edited by
                  #10

                  @Jonix-King 是不是无法在Qt界面中唤出中文输入法?如果是Linux平台可能和fcitx之类的输入法框架相关,印象中输入法是由输入法框架唤起的

                  J 1 Reply Last reply
                  0
                  • G Guo Tao

                    @Jonix-King You can derive a custom Edit widget from QLineEdit, replace the subclass original QLineEdit, and solve Chinese input.

                    J Offline
                    J Offline
                    Jonix King
                    wrote on last edited by
                    #11

                    @Guo-Tao Can you prompt for sample source code?

                    1 Reply Last reply
                    0
                    • W Wei Wei

                      @Jonix-King 是不是无法在Qt界面中唤出中文输入法?如果是Linux平台可能和fcitx之类的输入法框架相关,印象中输入法是由输入法框架唤起的

                      J Offline
                      J Offline
                      Jonix King
                      wrote on last edited by
                      #12

                      @Wei-Wei 我知道Linux平台是需要有外部插件提供支持的,但是浏览器估计原理并不不相同吧。看说明是由于安全性原因的限制

                      1 Reply Last reply
                      0
                      • JasonWongJ Offline
                        JasonWongJ Offline
                        JasonWong
                        wrote on last edited by JasonWong
                        #13

                        测试了,6.5.1版本也无法输入中文。
                        看网上有说输入的时候在html那边生成一个输入框,生成完成后再把文本传到qt这里。

                        另外,虽然6.5.1的release说明说修复了中文输入问题,但是我看实际的bug还没关闭,要等待6.5.2
                        https://bugreports.qt.io/browse/QTBUG-107139

                        1 Reply Last reply
                        0
                        • JasonWongJ Offline
                          JasonWongJ Offline
                          JasonWong
                          wrote on last edited by JasonWong
                          #14

                          经测试,6.5.2任然存在无法输入中文的问题,这是我的测试项目

                          After testing, the issue of unable to input Chinese still exists in 6.5.2, this is my test project.

                          https://web.jasonserver.com:10035/JQText/JQText.html
                          https://github.com/188080501/JQWeb

                          J 1 Reply Last reply
                          1
                          • R Offline
                            R Offline
                            RandomGuy
                            wrote on last edited by
                            #15

                            Will the bug fix of https://bugreports.qt.io/browse/QTBUG-107139 fix "accents" input in Linux desktop?

                            In Windows they work well, something like "é" works just fine, but in Linux they don't work, it will just display "e".

                            This in a QLineEdit.

                            In a portuguese keyboard "é" is inputted with '´' followed by 'e'.

                            If this issue is not related please let me know and I will create a separate bug for it. @lorn-potter

                            1 Reply Last reply
                            0
                            • JasonWongJ JasonWong

                              经测试,6.5.2任然存在无法输入中文的问题,这是我的测试项目

                              After testing, the issue of unable to input Chinese still exists in 6.5.2, this is my test project.

                              https://web.jasonserver.com:10035/JQText/JQText.html
                              https://github.com/188080501/JQWeb

                              J Offline
                              J Offline
                              Jonix King
                              wrote on last edited by
                              #16

                              @JasonWong 我已经绝望的放弃WASM了~~~

                              JasonWongJ 1 Reply Last reply
                              0
                              • J Jonix King

                                @JasonWong 我已经绝望的放弃WASM了~~~

                                JasonWongJ Offline
                                JasonWongJ Offline
                                JasonWong
                                wrote on last edited by
                                #17

                                @Jonix-King
                                估计修复最早也要6.5.4版本,但是我看还有几个分支没合并进去,这几天也没动静,估计又要等。我现在项目里work around就是调用web原生的输入框,就是操作起来有点麻烦。

                                1 Reply Last reply
                                0
                                • JasonWongJ Offline
                                  JasonWongJ Offline
                                  JasonWong
                                  wrote on last edited by
                                  #18

                                  无法输入中文,甚至某些情况下数字和英文输入都有问题。这已经无法满足一个基本程序的使用需求,还希望官网早点修复。

                                  Christian EhrlicherC 1 Reply Last reply
                                  0
                                  • JasonWongJ JasonWong

                                    无法输入中文,甚至某些情况下数字和英文输入都有问题。这已经无法满足一个基本程序的使用需求,还希望官网早点修复。

                                    Christian EhrlicherC Online
                                    Christian EhrlicherC Online
                                    Christian Ehrlicher
                                    Lifetime Qt Champion
                                    wrote on last edited by
                                    #19

                                    @JasonWong This is an english forum so please write in english or in the chinese subforum.

                                    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                                    Visit the Qt Academy at https://academy.qt.io/catalog

                                    JasonWongJ 1 Reply Last reply
                                    0
                                    • Christian EhrlicherC Christian Ehrlicher

                                      @JasonWong This is an english forum so please write in english or in the chinese subforum.

                                      JasonWongJ Offline
                                      JasonWongJ Offline
                                      JasonWong
                                      wrote on last edited by
                                      #20

                                      @Christian-Ehrlicher The issue with Chinese input has not been fixed, which means some of the most basic functionalities of the programs are not met. In some cases, it is even impossible to input numbers and English. This makes it difficult to promote the wasm platform. I recommended it to my friends, and the common feedback is that it is unusable until this issue is resolved. The reported bugs have not been fixed and have not been merged into the dev or 6.5.4 versions. I wonder when it can be fixed, and I hope the official website can fix it as soon as possible.

                                      1 Reply Last reply
                                      0
                                      • JasonWongJ Offline
                                        JasonWongJ Offline
                                        JasonWong
                                        wrote on last edited by
                                        #21

                                        @Jonix-King @Wei-Wei @jineter

                                        In the latest version( 6.8.0 beta3 ), it's finally possible to input Chinese.

                                        1 Reply Last reply
                                        1
                                        • J Offline
                                          J Offline
                                          Jonix King
                                          wrote on last edited by
                                          #22

                                          Really? This is so exciting
                                          I'm going to install the experiment right away

                                          1 Reply Last reply
                                          0

                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved