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. How to know when inputMethod is cancelled?
Forum Updated to NodeBB v4.3 + New Features

How to know when inputMethod is cancelled?

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 1 Posters 224 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.
  • T Offline
    T Offline
    ttammisa
    wrote on last edited by
    #1

    Hi!

    I have a custom widget that is using inputMethodEvent() and inputMethodQuery() to support, for example, Japanese input with mozc. Should eventually support different input methods also on Windows and Mac but for now I have just tested with Linux.

    I receive preedit text and render it to the widget at correct position. Also when event with commit text comes it is handled about ok. But how do I know if user cancelled the input method, for example by pressing esc? There does not seem to be any cancel signal in QInputMethod or in QWidget and the inputMethodEvent is not called in that case at all.

    I did little bit of research on how it works elsewhere. In some non-Qt application pressing esc cancelled the input method dialog (the one with possible composed input choises) and reset the state back to original. In qt application pressing the esc seemed to leave the preedit text in place although in somewhat strange states. For example moving cursor around it seemed to be odd. This also happened in QLineEdit standard in my own application.

    I have Qt version 5.9.5 which was installed by Ubuntu. I did some quick searches from Qt bugreports but failed to find anything but perhaps I did not search hard enough.

    So, if there is someone who could give some insight in this I would be very happy.

    1 Reply Last reply
    0
    • T Offline
      T Offline
      ttammisa
      wrote on last edited by
      #2

      After some though I realized this could also be a bug in mozc. I setup Anthy and with that things where bit better: now if I cancelled input I also received inputMethodEvent with both preedit and commit texts set to empty strings. If I used that as a que to reset the status all seemed work ok.

      Still, some other non-Qt applications seemed to work better even with mozc so I'm still not sure if there is something Qt should be doing differently here. And I still haven't checked any other platforms.

      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