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) ?
QtWS25 Last Chance

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.
  • S Offline
    S Offline
    SGaist
    Lifetime Qt Champion
    wrote on 31 Jan 2021, 18:53 last edited by
    #2

    Hi and welcome to devnet,

    You might want to give more details about your situation.

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lorn.potter
      wrote on 31 Jan 2021, 20:26 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 2 Feb 2021, 03:56
      1
      • L lorn.potter
        31 Jan 2021, 20:26

        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 2 Feb 2021, 03:56 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 26 May 2022, 13:26
        0
        • J Jonix King
          2 Feb 2021, 03:56

          @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 26 May 2022, 13:26 last edited by
          #5

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

          J 1 Reply Last reply 3 Jan 2023, 01:26
          0
          • W Offline
            W Offline
            wenqing zhong
            wrote on 31 May 2022, 04:10 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 1 Jun 2022, 04:50 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
                26 May 2022, 13:26

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

                J Offline
                J Offline
                Jonix King
                wrote on 3 Jan 2023, 01:26 last edited by
                #8

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

                G W 2 Replies Last reply 18 May 2023, 12:58
                0
                • J Jonix King
                  3 Jan 2023, 01:26

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

                  G Offline
                  G Offline
                  Guo Tao
                  wrote on 18 May 2023, 12:58 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 2 Jun 2023, 03:15
                  0
                  • J Jonix King
                    3 Jan 2023, 01:26

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

                    W Offline
                    W Offline
                    Wei Wei
                    wrote on 19 May 2023, 03:28 last edited by
                    #10

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

                    J 1 Reply Last reply 2 Jun 2023, 03:26
                    0
                    • G Guo Tao
                      18 May 2023, 12:58

                      @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 2 Jun 2023, 03:15 last edited by
                      #11

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

                      1 Reply Last reply
                      0
                      • W Wei Wei
                        19 May 2023, 03:28

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

                        J Offline
                        J Offline
                        Jonix King
                        wrote on 2 Jun 2023, 03:26 last edited by
                        #12

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

                        1 Reply Last reply
                        0
                        • JasonWongJ Offline
                          JasonWongJ Offline
                          JasonWong
                          wrote on 2 Jun 2023, 06:00 last edited by JasonWong 6 Feb 2023, 06:04
                          #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 24 Jul 2023, 02:57 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 18 Dec 2023, 09:54
                            1
                            • R Offline
                              R Offline
                              RandomGuy
                              wrote on 5 Sept 2023, 10:43 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
                                24 Jul 2023, 02:57

                                经测试,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 18 Dec 2023, 09:54 last edited by
                                #16

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

                                JasonWongJ 1 Reply Last reply 19 Dec 2023, 06:32
                                0
                                • J Jonix King
                                  18 Dec 2023, 09:54

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

                                  JasonWongJ Offline
                                  JasonWongJ Offline
                                  JasonWong
                                  wrote on 19 Dec 2023, 06:32 last edited by
                                  #17

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

                                  1 Reply Last reply
                                  0
                                  • JasonWongJ Offline
                                    JasonWongJ Offline
                                    JasonWong
                                    wrote on 19 Dec 2023, 06:33 last edited by
                                    #18

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

                                    Christian EhrlicherC 1 Reply Last reply 19 Dec 2023, 06:39
                                    0
                                    • JasonWongJ JasonWong
                                      19 Dec 2023, 06:33

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

                                      Christian EhrlicherC Offline
                                      Christian EhrlicherC Offline
                                      Christian Ehrlicher
                                      Lifetime Qt Champion
                                      wrote on 19 Dec 2023, 06:39 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 19 Dec 2023, 07:03
                                      0
                                      • Christian EhrlicherC Christian Ehrlicher
                                        19 Dec 2023, 06:39

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

                                        JasonWongJ Offline
                                        JasonWongJ Offline
                                        JasonWong
                                        wrote on 19 Dec 2023, 07:03 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 14 Aug 2024, 09:58 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

                                          • Login

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