Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Can't input Chinese in QPlainTextEdit
Forum Updated to NodeBB v4.3 + New Features

Can't input Chinese in QPlainTextEdit

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 4 Posters 1.6k Views 1 Watching
  • 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.
  • W Offline
    W Offline
    wij2
    wrote on last edited by
    #1

    I have a small text editor program using QTextEdit. When I
    changed to using QPlainTextEdit, it interpreted the keystrokes (in
    Chinese input mode) as normal latin1 characters!!! Can anyone help
    solving this problem. I am using Fedora29 and Qt5.

    1 Reply Last reply
    1
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What happens if you load a text containing chines characters in that widget ?

      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
      • W Offline
        W Offline
        wij2
        wrote on last edited by
        #3

        In almost aspects (display, find,...) QTextEdit and QPlainTextEdit
        behave the same in my simple editor. Except Chinese can't be keyed
        in if switched to using QPlainTextEdit.

        aha_1980A 1 Reply Last reply
        0
        • W wij2

          In almost aspects (display, find,...) QTextEdit and QPlainTextEdit
          behave the same in my simple editor. Except Chinese can't be keyed
          in if switched to using QPlainTextEdit.

          aha_1980A Offline
          aha_1980A Offline
          aha_1980
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @wij2 which Qt version is that exactly?

          Qt has to stay free or it will die.

          1 Reply Last reply
          0
          • W Offline
            W Offline
            wij2
            wrote on last edited by
            #5

            [wij2@localhost]$ qmake-qt5 --version
            QMake version 3.1
            Using Qt version 5.11.3 in /usr/lib64

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Did you check the bug report system ?

              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
              • W Offline
                W Offline
                wij2
                wrote on last edited by
                #7

                I checked the indicated web page just now, nothing relevant (keyword=QPlainTextEdit)

                The following are messages dumped on the terminal, hope it could provide more hints: (Except the issue that Chinese can't be input in QPlainTextEdit, the other one is Segmentation fault after su)

                [wij2@localhost]$ env | grep SESSION
                XDG_SESSION_ID=2
                DESKTOP_SESSION=gnome
                XDG_SESSION_TYPE=wayland
                XDG_SESSION_DESKTOP=gnome
                GDMSESSION=gnome
                DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
                SESSION_MANAGER=local/unix:@/tmp/.ICE-unix/1596,unix/unix:/tmp/.ICE-unix/1596
                [wij2@localhost]$ ./simple_qed
                Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
                ^C
                bash: history: write error: Success
                [wij2@localhost]$ su
                Password:
                [root@localhost]# ./simple_qed
                Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
                Qt: Session management error: None of the authentication protocols specified are supported
                Segmentation fault
                [root@localhost]#

                1 Reply Last reply
                0
                • Z Offline
                  Z Offline
                  Zorcs
                  wrote on last edited by
                  #8

                  Same problem:

                  At first, I can't input Chinese in anywhere cause my ubuntu don't have this support:

                  libfcitxplatforminputcontextplugin.so
                  

                  You can check this by:

                  dpkg -L fcitx-frontend-qt5 | grep .so
                  

                  to find where's the .so file. If not, just install it:

                  sudo apt-get install fcitx-frontend-qt5
                  

                  And next, you should copy this .so file to your Qt install package path, like this:

                  $ cd Qt5.9.0/Tools/QtCreator/lib/Qt/plugins/platforminputcontexts/
                  $ cp /usr/lib/x86_64-linux-gnu/qt5/plugins/platforminputcontexts/libfcitxplatforminputcontextplugin.so .
                  

                  Don't forget:chmod +x libfcitxplatforminputcontextplugin.so
                  Finally, restart Qt Creator and you can input Chinese in your code now.

                  However, sadly, I can't input Chinese in QPlainTextEdit. Need Help!

                  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