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. Need an example for proecessing unicode input and input method
Forum Updated to NodeBB v4.3 + New Features

Need an example for proecessing unicode input and input method

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 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.
  • B Offline
    B Offline
    BobWu
    wrote on last edited by
    #1

    Hi,

    I want to create a customize text editor control which will derive from QWidget or QWindow, if just support English, I can deal the keyboard events, but I need to support Chinese and other characters that will need a input method, but I don't know how to support input methods.
    I have read an simple example for Win32/MFC, and I remembered that it just need:

    Create an caret(how to creat a caret within Qt? I have not found a API for this purpose.) and show it, set the caret's position by calling SetCaretPos(...), and the input method's compositing window will appear below the caret's position(How to control this position within Qt? This is important, if we can't control the compositing window's position, then it will appear at the left corner of the QWindow QWidget or Desktop).

    Response the WM_CHAR message, this will get the characters from keyboard or input method(How to get these characters within Qt?).

    Draw the text, and set the caret's position again.

    I have read the documents for QInputMethodEvent and QInputMethodQueryEvent, but got nothing. And I have tried to read the QPlainTextEdit's source code, but I found that it's so complex, there's so many abstract layers that I can't understand immediately, I realy need a simple one.

    Thanks.

    1 Reply Last reply
    0
    • B Offline
      B Offline
      BobWu
      wrote on last edited by
      #2

      By response the KeyPress event, I can get the unicode characters now, but I still don't know how to create a caret and set it's position.
      May be I can draw a caret myself, and use a timer to control it's display, but, how to control the input methods' compositing window's position?

      1 Reply Last reply
      0
      • W Offline
        W Offline
        Wberdeenwa
        wrote on last edited by
        #3

        The post is very good.

        [img]http://www.52106.com/images/2.gif[/img]

        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