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. Save key input with japanish language (use of QInputMethodEvent)
Qt 6.11 is out! See what's new in the release blog

Save key input with japanish language (use of QInputMethodEvent)

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 737 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Hi,

    I have a Qt application and need to save user key input in an array. I mean, what user writes using keyboard (without using any textedit or similar) must be saved in an array.

    If I Use @MyClass::eventFilter( QObject *obj, QEvent *event )@

    method, 'QEvent::KeyPress' gives me input chars (keyEvent->key()), BUT NOT non-Latin characters, i.e. when japanish language is set.

    I have read about QInputMethodEvent Class (http://qt-project.org/doc/qt-5.0/qtgui/qinputmethodevent.html#details), and it seems to be what I need ('...Input methods are widely used to enter text for languages with non-Latin alphabets.'), BUT I do not understand how to use it...

    I have tested input panel example (http://qt-project.org/doc/qt-4.8/tools-inputpanel.html), and altough I understand what it does, I do not know how to use this classes for muy purpose.

    As far as I know:

    I need a Widget (class A) which receives input chars using @void inputMethodEvent( QInputMethodEvent* m )@

    previous setAttribute( Qt::WA_InputMethodEnabled). But this method is called from a QInputContext. When a QTextEdit is used, a generic QInputContext calls automatically this method and the text is displayed on the edit.
    But in my case I have no textEdit, so I suppose I need a class B which inherits QInputContext and sends this event somewhen. But I do not how to do this... If I use '::eventFilter' in class B, I receive char input, BUT when I set japanish, as I said previously.

    I am really stuck, so I would appreciate any help.

    Thanks in advance,

    Diego

    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